Description
Use the PRH parameter to include the Print Record Header at the beginning of the Print Records. The header contains the request name which can be used to sort the records in the PRINT TO file and regrouping the records into their separate and distinct reports before printing.
Solution
Modify all the EXTRACT and SUMMARIZE requests that are writing to the same PRINT TO output file and specify the request parameter PRH=YES.
REPORT1: EXTRACT (PRH=YES) . . . PRINT TO APASRPTS; REPORT2: SUMMARIZE (PRH=YES) . . . PRINT TO APASRPTS;
A header is included at the beginning of each record written to the PRINT TO file that looks like this:
REPORT1 ....ADAV8DB1..CPU1 2009081119213520090812040644433.DE12009-08-11 19:21:35 REPORT1 ....ADAV8DB1..CPU1 2009081119213520090812040644433.DE EXTRACT: REPORT1 REPORT1 ....ADAV8DB1..CPU1 2009081119213520090812040644433.DE FIRST RECORD REPORT1 ....ADAV8DB1..CPU1 2009081119213520090812040644433.DE REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS12009-08-11 19:21:35 REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS SUMMARY: REPORT2 REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS INTERVAL START REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS FIRST RECORD REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS ENTRY ENTRY REPORT2 ....ADAV8DB1..CA31 2009081119213520090812040600433.IS DATE TIME
The first field is the request name, in this example REPORT1 and REPORT2. The next field is the sequence number of the record in binary. The final field in the header is the Record Type: IS for Interval Summary; GT for Grand Total; SU for Summary without Interval; and DE for Detail record. A complete list of all the Print Record Header fields and an explanation of the fields is in Appendix A of the CA APAS Systems Guide.
When the output from the PRINT TO file is ready to be printed, sort the records using the Request name and Record number fields of the header.
Here is an example of a CASORT job to combine the respective report lines for a request together and remove the PRH from the sorted records:
/* ----------------------------------------------------------- /* REMOVE THE PRINT RECORD HEADER (PRH) FROM PRINT TO FILE /* PRIOR TO PRINTING /* ----------------------------------------------------------- //CASORT EXEC PGM=SORT //SYSIN DD * SORT FIELDS=(5,8,CH,A,13,4,BI,A) OUTREC FIELDS=(1,4,69) //SORTIN DD DSN=hlq.mlq.APASRPTS,DISP=(OLD,KEEP,KEEP) //SORTOUT DD DSN=hlq.mlq.APASRPTS.SORTED,DISP=(NEW,CATLG,DELETE), // UNIT=diskunit,VOL=SER=volser,SPACE=(CYL,(pp,ss),RLSE), // DCB=(RECFM=VB,LRECL=lrecl,BLKSIZE=lrecl+4)
If using variable blocked records (VB), the RDW must be copied from the input record to the sorted output record by specifying it as the first field in the OUTREC - FIELDS=(1,4,.... Skip over the header, which is 65 bytes in length, and include the report record starting at offset 69 until the end of the record.
Note that the sort control cards may need to be modified accordingly for the sort utility used on your system.
Warning:
Coding the PRH parameter in a request overrides the GLOBALS statement value of PRH that would otherwise have been in effect for the request and for all other requests with print output to the same ddname. That is, if any request specifies PRH=YES, then all requests using that PRINT TO ddname have print headers, regardless of the value of PRH in the GLOBALS statement or in the individual requests.