Yvonne1980
New User
Joined: 31 Aug 2010 Posts: 20 Location: Edinburgh
|
|
|
|
I'm trying to pick up a date from a pds member, rearrange it and place in the header of my sortout file. I can't figure out how to tell sort to get the required string from a file ?
The PDS member is a FB 80 file with the the date in the following layout DD/MM/YYYY occupying the first 10 chars of the PDS member:
Example PDS: XXXX.YYYY.ZZZZ(TODAY)
My SORTIN file is a FB 60 file that requires the date from the PDS to be inserted at col 20 in the format YYYYMMDD, the rest of the header should remain unchanged:
The rest of the SORTIN detail and trailer recs should be copied unchanged
Example input:
Code: |
0XXXXXXXXXXXXXXXXXX20120401YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
1Record001
1Record002
1Record003
1Record004
1Record005
9Trailer
|
Desired output (only the header date has changed):
Code: |
0XXXXXXXXXXXXXXXXXX20120524YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
1Record001
1Record002
1Record003
1Record004
1Record005
9Trailer
|
Many thanks. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Yvonne1980,
Assuming that your header record begins with a zero and is the only header then you can use the following joinkeys job
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD *
0XXXXXXXXXXXXXXXXXX20120401YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY
1RECORD001
1RECORD002
1RECORD003
1RECORD004
1RECORD005
9TRAILER
//INB DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+----7
24/05/2012
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(1,1,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(1,1,A),SORTED,NOSEQCK
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,60,?,F2:2,8)
INREC IFOUTLEN=60,IFTHEN=(WHEN=(61,1,CH,EQ,C'B'),OVERLAY=(20:62,8))
//*
//JNF2CNTL DD *
INREC BUILD=(C'0',7,4,4,2,1,2)
//* |
|
|