MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

pick only previous, current, future-1 and future-2 dates.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Jan 04, 2010 10:48 pm    Post subject: pick only previous, current, future-1 and future-2 dates. Reply with quote

Hi,

Our customer sends us a file with data to be processed. It contains CCYY in the first four bytes. Our program handles only the current, previous, future-1 and future-2 dates only.

Quote:

example:
Current - 2010
Previous- 2009
Future-1 - 2011
Future-2 - 2012


The data in input file appears as shown below: (LRECL:80, RECFM:FB)
Code:

2003 XXX X1X1X1X1
2003 TTT T1T1T1T1
2004 YYY Y1X1Y1T1
2005 BBB B1T1X1X2
2006 CCC C1X1Y1T1
2009 PPP P1X1C1T1
2010 GGG G1X1T1P1
2011 EEE E1T1X1Y1
2012 VVV V1P1X1T1
2013 KKK K1P1T1C1


I want only the below data in output file: (LRECL:80, RECFM=FB)
Code:

2009 PPP P1X1C1T1
2010 GGG G1X1T1P1
2011 EEE E1T1X1Y1
2012 VVV V1P1X1T1


So, the output file should contain Previous (2009), Current (2010), Future-1 (2011), and Future-2 (2012) for this year. For next year it should be Previous (2010), Current (2011), Future-1 (2012), and Future-2 (2013) and so on..........

How to get it using SORT?

TIA.

Regards.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Jan 05, 2010 11:59 am    Post subject: Reply with quote

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
DUMMY
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN    DD    *
  OPTION COPY
  INREC BUILD=(DATE2P)
  OUTFIL BUILD=(C'STARTYR,+',1,3,PD0,SUB,+1,EDIT=(TTTT),80:X,/,
                C'ENDYR,+',1,3,PD0,ADD,+2,EDIT=(TTTT))
/*
//S2  EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=...  output file (FB/80)
//SYSIN    DD    *
 OPTION COPY
 INCLUDE COND=(1,4,ZD,GE,STARTYR,AND,1,4,ZD,LE,ENDYR)
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jan 06, 2010 10:23 am    Post subject: Thx Reply with quote

Hi,

Thank you very much for the solution. It is working for me. I have got one doubt. Why it had to create symbols with a '+' in front of year part? What happens if just STARTYEAR,2009 was created?

Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Wed Jan 06, 2010 12:07 pm    Post subject: Reply with quote

The '+' isn't needed in this case. I tend to use it because it is needed for decimal constants in the BUILD operand, and it doesn't hurt to have the '+'.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Wed Jan 06, 2010 2:28 pm    Post subject: Reply with quote

Ok. Thanks.
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group