Posted: Wed Oct 05, 2011 8:00 am Post subject: Different detailed records count
Hi,
I have one file with Header, and two type of detailed records.
Header is identified by 'HD' in first two bytes.
Two types of detailed records are identified by 'AC' and 'AD' respectively.
I need to print detailed along with header and trailer; showing total detailed records count in first 5 bytes, 'AC' records count in next 5 bytes, 'AD' records count in next 5 bytes.
For example
For input file:
Code:
HD
AC
AC
AD
AD
AD
Output file should be:
Code:
HD
AC
AC
AD
AD
AD
000050000200003
Please help to get above result _________________ Thanks
Madhu Sudhan
Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Wed Oct 05, 2011 10:27 am Post subject:
psmadhusudhan,
Assuming the LRECL=80 and RECFM=FB , the following DFSORT JCL will give you the desired results. Do not use this solution for VB files.
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
HD
AC
AC
AD
AD
AD
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),
IFTHEN=(WHEN=(1,2,CH,EQ,C'AC'),OVERLAY=(81:C'1')),
IFTHEN=(WHEN=(1,2,CH,EQ,C'AD'),OVERLAY=(82:C'1'))
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