Posted: Fri Jun 06, 2003 3:43 am Post subject: DFSORT Report
I am just wondering if I could create the following report using one sort statement.
My requirement follows.
I have 2 Input Files , File A and File B
Code:
FILE A
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
9 Trailer record 3
Code:
FILE B
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
2 Detail - 4
2 Detail - 5
9 Trailer record 5
My requirement follows.
1) If the header date in both file does not match then return code should be greater 0
2) I have to format the Header date as 'June 05,2003' if the date is 050603.
3) I have to add the trailer count in both files and print it on the report
4) Also I need to print the record count on each trailer record individually.
Code:
Report Format
' 30 byte Hard coded text ' June 05,2003 '20 byte hardcoded text'
Total record count is 8
blank line
Record count on File A is 3
blank line
Record count on File B is 5
blank line
' 65 byte hardcoded text'
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Jun 06, 2003 11:25 am Post subject:
Menon,
Here's a DFSORT/ICETOOL job that uses DFSORT symbols to produce a report similar to what you want. STEP2 gives RC=0 if the dates match or RC=12 if the dates don't match.
I used ADD which is new in DFSORT R14 PTF UQ90053 (Feb, 2003). If you don't have that PTF, we could do the equivalent of the ADD another, more complicated way.
Note that I've used DFSORT editing masks to format the totals - you can use different editing masks if you want to change the way the totals look in the report.
Code:
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILE1 DD *
1 Header Record 050603
2 Detail - 1
2 Detail - 2
2 Detail - 3
9 Trailer record 3
//FILE2 DD *
1 Header Record 060603
2 Detail - 1
2 Detail - 2
2 Detail - 3
2 Detail - 4
2 Detail - 5
9 Trailer record 5
//I1 DD DSN=&&I1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//S1 DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//S2 DD DSN=&&S2,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(MOD,PASS)
//TOOLIN DD *
COPY FROM(FILE1) USING(CTL1)
COPY FROM(FILE2) USING(CTL2)
/*
//CTL1CNTL DD *
* Get File1 Header with 'ddmmyy' date for comparison
OUTFIL FNAMES=I1,ENDREC=1
* Create DFSORT symbol as follows from ddmmyy date in File1 Header
* F1DATE2,'month dd,20yy'
OUTFIL FNAMES=S1,REMOVECC,ENDREC=1,
OUTREC=(C'F1DATE2,''',
19,2,CHANGE=(9,C'01',C'January',C'02',C'February',
C'03',C'March',C'04',C'April',C'05',C'May',C'06',C'June',
C'07',C'July',C'08',C'August',C'09',C'September',
C'10',C'October',C'11',C'November',C'12',C'December'),
X,17,2,C', 20',21,2,C'''',80:X)
* Create DFSORT symbols as follows for File1 detail record count
* F1TRLCT1,'nnn'
* F1TRLCT2,+n
OUTFIL FNAMES=S2,REMOVECC,NODETAIL,
INCLUDE=(1,1,CH,EQ,C'2'),
TRAILER1=(C'F1TRLCT1,''',COUNT=(EDIT=(IIT)),C'''',80:X,/,
C'F1TRLCT2,',COUNT=(M26),80:X)
/*
//CTL2CNTL DD *
* Create DFSORT symbol as follows from ddmmyy date in File1 Header
* F2DATE1,'ddmmyy'
OUTFIL FNAMES=S1,REMOVECC,ENDREC=1,
OUTREC=(C'F2DATE1,''',17,6,C'''',80:X)
* Create DFSORT symbols as follows for File2 detail record count
* F2TRLCT1,'nnn'
* F2TRLCT2,+n
OUTFIL FNAMES=S2,REMOVECC,NODETAIL,
INCLUDE=(1,1,CH,EQ,C'2'),
TRAILER1=(C'F2TRLCT1,''',COUNT=(EDIT=(IIT)),C'''',80:X,/,
C'F2TRLCT2,',COUNT=(M26),80:X)
/*
//STEP2 EXEC PGM=ICETOOL
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
// DD DSN=&&S2,DISP=(OLD,PASS)
//SYMNOUT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//I1 DD DSN=&&I1,DISP=(OLD,PASS)
//RPT DD SYSOUT=*
//TOOLIN DD *
* SET RC=0 IF FILE1 DATE MATCHES FILE2 DATE
* SET RC=12 IF FILE1 DATE DOES NOT MATCH FILE2 DATE
COUNT FROM(I1) USING(CTL1) EMPTY
COPY FROM(I1) USING(CTL2)
/*
//CTL1CNTL DD *
* COMPARE FILE1 'ddmmyy' date to previously created
* DFSORT symbol for FILE2 'ddmmyy' date
INCLUDE COND=(17,6,CH,EQ,F2DATE1)
/*
//CTL2CNTL DD *
* Generate report using previously created DFSORT symbols
OUTFIL FNAMES=RPT,
OUTREC=(C'30 byte hard coded text',X,
F1DATE2,X,
C'20 byte hard coded text',80:X,/,
C'Total record count is ',
(F1TRLCT2,ADD,F2TRLCT2),EDIT=(IIT),//,
C'Record count on File A is ',F1TRLCT1,//,
C'Record count on File B is ',F2TRLCT1,//,
C'65 byte hard coded text')
/*
Here's the report this produced:
Code:
30 byte hard coded text June 05, 2003 20 byte hard coded text
Total record count is 8
Record count on File A is 3
Record count on File B is 5
65 byte hard coded text
_________________ 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
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