I get a report (consisting of 'n' records)from the upstream, and I need break the page and append the header with page number.
say below is my sample input:
Code:
FUND# FUND NAME PRICE
AAA123 xxxxxxxxxx xxxxxxx CORE FUND 115544
BBB123 yyyyyyyyyy yyyyyyy VALUE FUND 222233
AAB123 zzzzzzzzz zzzzzzzzzz GROWTH FUND 999999
.
.
.
. there might be around 3K records
My sample output should look like
Code:
PROGRAM : CUXXXXX ABCDEFGH INVESTMENTS SUPPORT SYSTEMS PAGE : 1
REPORT ID: CUXXXXX01 TRADE PRICE BY FUND RUN DATE : 10/31/11
SYSTEM DATE : 11/01/11
TIME : 10:10:35
REPORTING PERIOD : OCTOBER 2011
FUND# FUND NAME PRICE
AAA123 xxxxxxxxxx xxxxxxx CORE FUND 115544
BBB123 yyyyyyyyyy yyyyyyy VALUE FUND 222233
AAB123 zzzzzzzzz zzzzzzzzzz GROWTH FUND 999999
.
.
.
Break the page at the end and have the header repeated with page nubmers.
report length 133
Fund# is 6 Char
Fund Name is 30 char
Price is 6 digit
Can anyone please let me know if we can do it with sort?
Yes, you can break the report under various pages. Have you tried the HEADER option available, if not try it and post us what difficulty you face in achieving the output mentioned.
HEADER1 :- Specifies the report header to be used for the reports produced for this OUTFIL group. The report header appears by itself as the first page of the report.
HEADER2 :- Specifies the page header to be used for the reports produced for this OUTFIL group. The page header appears at the top of each page of the report, except for the report header page (if any) and report trailer page (if any).
HEADER3 :- Specifies the section header to be used with the associated section break field for the reports produced for this OUTFIL group. The section header appears before the first data record of each section.
ratnakumar,
Where are you getting run date from? Input file? If yes, please provide format/position and length of the date? In your report, how is run date different from system date?
Based on your HEADER1 statement provided earlier, your output doesn't match the sort card you provided.
Also please confirm OCTOBER 2011 is derived from run date.
My job runs every month 1st. which processess the data for entire last month.
(Hence Run date would be current month and Reporting date would be the last month)
I get a date file, from the previous step, and it looks as shown below:
Code:
---+----1----+-
***************
OCTOBER 2011
***************
And I just need to update the field "REPORTING PERIOD :" with the date provided in the date file
ratnakumar,
See if below works....since you haven't really given input file's LRECL, I am going to assume it will be atleast less than or equal to 133. If its not you need, please post sample input and positions for the FUND#,FUND NAME and FUND PRICE.
Code:
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD YOUR DATE FILE FROM PREV. STEP
//DATEFL DD DSN=&&DT,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=DATEFL,REMOVECC,NODETAIL,
BUILD=(80X),
TRAILER1=('DT,C''',01,15,C'''')
/*
//STEP0002 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&DT,DISP=(OLD,PASS)
//SORTIN DD YOUR INPUT FILE WITH APPROX. 3K RECORDS
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL HEADER2=(001:'PROGRAM : CUXXXXX',
047:'ABCDEFGH INVESTMENTS SUPPORT SYSTEMS',
114:'PAGE:',PAGE,/,
001:'REPORT ID: CUXXXXX01',
050:'TRADE PRICE BY FUND ',
110:'RUN DATE:',DATE,/,
107:'SYSTEM DATE:',DATE,/,
114:'TIME:',TIME,/,
001:'REPORTING PERIOD : ',DT,/)
/*
Frank,
Thanks for the correction on HEADER2, I copied OP's card but forgot to change HEADER1 to 2.
Quote:
Personally, I would use INREC BUILD rather than OUTFIL TRAILER1 to build the symbol:
However, I have seen solution using INREC BUILD and OUTFIL to build symnames and I kind of want to take this opportunity to ask you which is better?
I was leaning towards OUTFIL so that if a date file (or any file used to build symname) is empty, it atleast puts spaces. On the other hand, using INREC BUILD to create SYMNAME results in abend in next step if a file to create symname is empty.
Is this just a personal preference or a good coding practice or something related to efficiency(because of the different DFSort phases for INREC and OUTFIL)?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
If we know we have only one record to create the symbol from and that record is always there (which seemed to be the case here), I would use INREC because it's simpler - just BUILD vs OUTFIL for which you'd need REMOVECC,NODETAIL,BUILD and TRAILER1. Just a personal preference.
If you're trying to build a symbol from an empty data set, it isn't going to work either way.