sunilsai Beginner
Joined: 20 Oct 2015 Posts: 2 Topics: 2
|
Posted: Sat Oct 31, 2015 11:04 am Post subject: Need help in SORT jcl |
|
|
Hi All,
I have two flat file having reclords like this
file 1
Code: |
batch running 30-12-15
last batch 29-12-15
|
file2
Code: |
changed memo 15-12-15
changed bill 16-12-15
|
I want to sort this files into single Dataset having records like
Code: |
date1 29-12-15
date2 30-12-15
date3 15-12-15
date4 16-12-15
|
*these date1, date2...are constants. But the dates are changing daily in that files. these to be append at the end of constants.
please help in this regard.
Thanks
sunilsai _________________ Thanks
Sunilsai |
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
|
Posted: Sun Nov 01, 2015 12:02 pm Post subject: |
|
|
Sunilsai,
Your description does not match output. when you sort the data, you should have 15 and 16 dates much before 29 and 30.
It seems to me that you need to sort individual files and then merge them together into a single file.
Here is an untested DFSORT job that would give you the desired results
I assumed that the date is in the format dd-mm-yy and in the first file it is at position 16 and then in the second file it is at position 14. I used the string "changed" in your second file to re-arrange the date.
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=YOUR INPUT FILE1
// DD DISP=SHR,DSN=YOUR INPUT FILE2
//SYSIN DD *
OPTION STOPAFT=4
INREC IFTHEN=(WHEN=(1,7,CH,EQ,C'CHANGED'),
BUILD=(20,2,17,2,14,2,C'1')),
IFTHEN=(WHEN=NONE,
BUILD=(22,2,19,2,16,2,C'0'))
SORT FIELDS=(1,6,Y2T,A,
7,1,CH,A),EQUALS
OUTREC BUILD=(c'DATE',SEQNUM,1,ZD,X,5,2,C'-',3,2,C'-',1,2)
//* |
_________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu |
|