In the z/OS V1R12.0 DFSORT Application Programming Guide it has the following section:
3.15 OUTFIL Control Statements
LINES, HEADER1, TRAILER1, HEADER2, TRAILER2, SECTIONS, and NODETAIL indicate that a report is to be produced for an OUTFIL group, and specify the details of the report records to be produced for the report. Reports can contain report records for a report header (first page), report trailer (last page), page header and page trailer (at the top and bottom of each page, respectively), and section headers and trailers (before and after each section, respectively).
Data records for the report result from the inclusion of OUTFIL input records. All of the capabilities of the OUTREC, BUILD, OVERLAY, FINDREP , or IFTHEN parameters are available to create reformatted data records from the OUTFIL input records. Each set of sequential OUTFIL input records, with the same binary value for a specified field, results in a corresponding set of data records that is treated as a section in the report.
The length for the data records must be equal to or greater than the maximum report record length.
I don't understand the restriction specified in the last sentence. The data records are possible reformats of the input record, but are also report records, so how could they have a length longer than the report record length?
Puzzlingly, one of the examples, 3.15.2.4 Example 4, has: OUTREC=(6:16,13,24:31,10,ZD,M5,LENGTH=20,75:X), with the explanation: 75:X is used at the end of the OUTREC parameter to ensure that the data records are longer than the report records. This will result in an LRECL of 76 for the fixed-length OUTFIL data set (1 byte for the ANSI control character and 75 bytes for the data).
But the length of the longest line in the report is this one of length 71 (starting in column 8): Summary of Profit/(Loss) for all Western Division Branch Offices: why the extention to column 75, and why refer to the data records as though they're not report records?
One of the characteristics of the report dataset is the LRECL, which can be specified or assigned by DFSORT. If it's not specified then surely DFSORT can assign an LRECL equal to the length of the longest report record; and if specified then why can't this be longer than the longest report record (I presume that if it's specified as shorter than the longest report record then either DFSORT will assign an LRECL equal to the longest record, or abend)?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Jim Alton wrote:
The length for the data records must be equal to or greater than the maximum report record length.
I don't understand the restriction specified in the last sentence. The data records are possible reformats of the input record, but are also report records, so how could they have a length longer than the report record length?
Jim Alton,
It is possible to create a header larger than the actual data record. For ex:
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+
JIM ALTON
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,10)
OUTFIL HEADER1=(3:1,10,' HAS A QUESTION ABOUT OUTFIL LRECL ')
//*
If you look at the job above , the actual record length is only 10 bytes whereas the header I am trying to create is 50 bytes in length. DFSORT picks up the OUTPUT file attributes from either input DCB or the INREC/OUTREC parameters. So if you are coding a header of 50 bytes you need to PAD ALL your 10 byte records with spaces upto 50 bytes so that you can have the entire 50 byte header.
Run the same job as is and you will get the message
Code:
ICE230A 0 50 BYTE HEADER/TRAILER RECORD EXCEEDS 11 BYTE LRECL FOR SORTOUT
So it is necessary that the length for the data records must be equal to or greater than the maximum report record length.
Jim Alton wrote:
Puzzlingly, one of the examples, 3.15.2.4 Example 4, has: OUTREC=(6:16,13,24:31,10,ZD,M5,LENGTH=20,75:X), with the explanation: 75:X is used at the end of the OUTREC parameter to ensure that the data records are longer than the report records. This will result in an LRECL of 76 for the fixed-length OUTFIL data set (1 byte for the ANSI control character and 75 bytes for the data).
But the length of the longest line in the report is this one of length 71 (starting in column 8): Summary of Profit/(Loss) for all Western Division Branch Offices: why the extention to column 75, and why refer to the data records as though they're not report records?
If you looked at the example the data record is only 50 bytes in length, and it is the constant on the trailer that extends upto 71 bytes. 75:x is used to ensure that you have a couple of spaces to the right on the report. The spaces at the end is a pure personal choice of how you want the report to look like.
Thanks for the explanation, which is that the LRECL is taken from either the DCB or the length of the INREC/OUTREC, and not taking into account the length of headers or trailers, which are also records of the output dataset. The explanation gives a reason why the length for the data records must be equal to or greater than the maximum report record length, but you wouldn't need the restriction, or artificially extend the OUTREC in the example I refer to, if the length of headers/trailers are also taken into account - is this so hard to do when they are of fixed length?
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Jim Alton wrote:
Dear Skolusu,
Thanks for the explanation, which is that the LRECL is taken from either the DCB or the length of the INREC/OUTREC, and not taking into account the length of headers or trailers, which are also records of the output dataset. The explanation gives a reason why the length for the data records must be equal to or greater than the maximum report record length, but you wouldn't need the restriction, or artificially extend the OUTREC in the example I refer to, if the length of headers/trailers are also taken into account- is this so hard to do when they are of fixed length?
Jim Alton,
Easier Said Than Done. You need to understand that HEADER and TRAILER parms can be split on to multiple lines using "/" and it would get really complicated to extend the length based on those parameters.