MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
Redrose Beginner Joined: 29 Sep 2006 Posts: 13 Topics: 6
Posted: Tue Feb 27, 2007 9:12 am Post subject: DFSORT - How to generate reports
Hi All,
I have two input files of LRECL=80 with data as below.
Input File 1: The value of fourth column 'P indicates Production'
AAAP
BBBP
CCCP
DDDP
Input File 2: The value of fourth column 'T indicates Test'
AAAT
BBBT
CCCT
I would like to have two output files as below.
The Output file 1 should have the data as in code window as below.
with headers and records from both Input 1 & 2.
Code: There are 4 production and 3 test records found.
A) Production records:
AAAP
BBBP
CCCP
DDDP
B) Test records:
AAAT
BBBT
CCCT
Output File 2:
This file need to have a copy of all records from Input Files 1 & 2 and with LRECL=132 (First 80 bytes of data remaining 52 with spaces)
Is is possible to acheive the above in single step with DFSORT/ICETOOL?
Thanks in Advance
Regards,
Ramanan R
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
Posted: Tue Feb 27, 2007 9:44 am Post subject:
Ramanan,
Try this DFSORT/ICETOOL jCl which will give you the desired results.
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAAP
BBBP
CCCP
DDDP
AAAT
BBBT
CCCT
//T1 DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) USING(CTL2)
//CTL1CNTL DD *
OUTREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:C'00')),
IFTHEN=(WHEN=(04,01,CH,EQ,C'P'),
OVERLAY=(81:C'1',
83:C'A.) PRODUCTION ')),
IFTHEN=(WHEN=(04,01,CH,EQ,C'T'),
OVERLAY=(82:C'1',
83:C'B.) TEST '))
OUTFIL FNAMES=T1,REMOVECC,
SECTIONS=(04,01,
HEADER3=(82X,
83,2,/,
83,15,
C' RECORDS:',
83:83,2,/,
82X,
83,2)),
TRAILER1=(C'THERE ARE ',
TOT=(81,1,ZD,EDIT=(TTTTTTTT)),
C' PRODUCTION AND ',
TOT=(82,1,ZD,EDIT=(TTTTTTTT)),
C' TEST RECORDS FOUND.',
80:X)
OUTFIL FNAMES=OUT2,
OUTREC=(01,80,52X)
/*
//CTL2CNTL DD *
SORT FIELDS=(83,2,CH,A)
OUTFIL FNAMES=OUT1,
OUTREC=(01,80)
/*
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu
Back to top
Redrose Beginner Joined: 29 Sep 2006 Posts: 13 Topics: 6
Posted: Tue Feb 27, 2007 10:16 am Post subject:
Kolusu,
Thanks for your help
Regards,
Ramanan R
Back to top
Frank Yaeger Sort Forum Moderator Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Feb 27, 2007 2:03 pm Post subject:
Ramanan R,
Here's another way to do it with DFSORT/ICETOOL:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1 (FB/80)
// DD DSN=... input file2 (FB/80)
//SYMP DD DSN=&&SP,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYMT DD DSN=&&ST,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=SYMP,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'P'),
TRAILER1=(C'P_CT,''',COUNT=(EDIT=(T)),C'''')
OUTFIL FNAMES=SYMT,REMOVECC,NODETAIL,
INCLUDE=(4,1,CH,EQ,C'T'),
TRAILER1=(C'T_CT,''',COUNT=(EDIT=(T)),C'''')
/*
//S2 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYMNAMES DD DSN=&&SP,DISP=(OLD,PASS)
// DD DSN=&&ST,DISP=(OLD,PASS)
//INP DD DSN=... input file1 (FB/80)
//INT DD DSN=... input file2 (FB/80)
//RPT1 DD DISP=MOD,DSN=... output file1
//RPT2 DD DISP=MOD,DSN=... output file2
//TOOLIN DD *
COPY FROM(INP) USING(CTL1)
COPY FROM(INT) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=RPT1,REMOVECC,
HEADER1=('There are ',P_CT,' production and ',T_CT,
' test records found.',/,X,/,
'A) Production records:',/)
OUTFIL FNAMES=RPT2,OVERLAY=(132:X)
/*
//CTL2CNTL DD *
OUTFIL FNAMES=RPT1,REMOVECC,
HEADER1=(/,X,/,'B) Test records:',/)
OUTFIL FNAMES=RPT2,OVERLAY=(132:X)
/*
_________________ 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
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