The SortWriter facility provides three types of trailers:
-
TRAILER1, the report trailer
-
TRAILER2, the page trailer
-
TRAILER3, the section trailer.
TRAILER1 and TRAILER2 are parameters of the OUTFIL control statement; TRAILER3 is a subparameter of OUTFIL’s SECTIONS parameter. Refer to SECTIONS Parameter (Optional) for an explanation of how to specify TRAILER3.
The three types of trailers function independently of each other. Each serves a different purpose:
-
TRAILER1 provides a trailer or a possible summary for the entire report. It appears only once at the end of the report on its own page.
-
TRAILER2 provides a page trailer for each page defined by the LINES parameter. It appears at the end of each page.
-
TRAILER3 provides a section trailer that appears at the end of each specified section and serves as a conclusion or summary for that section.
TRAILER1, TRAILER2, and TRAILER3 also provide TOTAL, SUBTOTAL, MIN, SUBMIN, MAX, SUBMAX, AVG, SUBAVG, COUNT, SUBCOUNT, COUNT15, and SUBCOUNT15 capabilities at report, page, and section levels.
c: |
Use the c: subparameter to define the column in which the specified field should begin. The c: value will ignore the carriage control character and, for variable-length records, the RDW. EBCDIC blanks will precede the specified column when needed. |
n |
Used in conjunction with the X, X'hh..hh', 'literal string', and / subparameters, the n value defines the number (1-4095) of occurrences for each entry. |
X |
Use the X subparameter to define the number of spaces. It must be coded to the immediate right of the n value, if specified. For more than 4095 spaces, two or more nX values should be specified. |
X'hhhh...hh' |
Use the X'hhhh...hh' entry to specify that a hexadecimal string should be inserted in the header. (Each hh pair is 1 byte of output.) Specify the number of occurrences by coding n immediately before it. |
'literal string' |
Use the 'literal string' subparameter to define a literal string. Specify the number of repetitions by specifying n immediately before it. An apostrophe within a literal string must be specified as a double apostrophe; for example, – 'O"Leary'. |
/ |
Use the / subparameter to indicate the end of a line, force a carriage return, and separate text lines of a trailer. Multiple slashes (coded //.../ or n/) can be used to specify leading, trailing, or embedded blank lines. At the beginning or ending of a trailer, n/ produces n blank lines. Within a trailer, n/ produces n-1 blank lines. |
p,l |
Use the p and l subparameters to include a field (or fields) within a record in the trailer. For a TRAILER1, the field(s) will be extracted from the last record in a file; for a TRAILER2, the field(s) will be extracted from the last record on a page; for a TRAILER3, the field(s) will be extracted from the last record in a section. p is the starting position of the field in the record; l is the length in bytes (1-32752) of the field. Any number of fields can be specified. (Contiguous fields within a record may be specified with a single p,l entry, but their combined length may not exceed 32752 bytes.) The specified field(s) should be a character or alphanumeric string, or a number in printable format, and the field cannot be converted or edited. If any variable-length record contains only a portion of the bytes in a specified field, those bytes will be included in the trailer and blanks will be substituted for the missing bytes. |
&DATE [{±}nnnn] |
The &DATE subparameter specifies the current system date or date with offset and requires 8 bytes to display mm/dd/yy. Optionally, you can create an offset of the current date. The offset takes the form {±}nnnn, where '+' indicates a date after the current date and '–' indicates a date before the current date. 'nnnn' is the date offset. The range is 0 to 9999, which represents the number of days to be added or subtracted from the current date. |
&DATE=(m1m2m3m4)[{±}nnnn] |
This form of the &DATE subparameter generates the current system date or date with offset and controls the formatting of the date. You can specify the position of the year, month, and day, specify a separator character, and choose between 2-digit and 4-digit year representation. The positions m1 through m4 represent masks used to format the date. To specify the position of the month, day, and year, replace the m1, m2, and m3 positions, in any order, with M for the month (01-12), D for the day (01-31), and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year). Replace the m4 position with a separator character. For example, to print the date with the form yy-mm-dd, specify &DATE=(YMD-). For December 31, 1999, the date would appear as “99-12-31”. The field for this form of &DATE requires 8 bytes for a 2-digit year representation and 10 bytes for a 4-digit year. The M, D, and Y or 4 may only appear once in the mask. All four positions must be specified. Optionally, you can create an offset of the current date. See &DATE [{±}nnnn] for a description. |
&DATENS=(xyz)[{±}nnnn] |
This form of the &DATENS subparameter specifies that the current date or date with offset is to appear in the report record in the form 'xyz', where x, y, and z indicate the order in which the month, day, and year are to appear and whether the year is to appear as two or four digits. For x, y, and z, use M to represent the month (01-12), D to represent the day (01-31), Y to represent the last two digits of the year (for example, 02), or 4 to represent the four digits of the year (for example, 2002). M, D, and Y or 4 can each be specified only once. For example, &DATENS=(DMY) would produce a date of the form 'ddmmyy' which on March 29, 2002, would appear as '290302'. &DATENS=(4MD) would produce a date of the form 'yyyymmdd' which on March 29, 2002, would appear as '20020329'. x, y, and z must be specified. Optionally, you can create an offset of the current date. See &DATE [{±}nnnn] for a description. |
&YDDD=(m1m2m3)[{±}nnnn] |
This form of the &YDDD subparameter specifies that the current date or date with offset is to appear in the report record in the form of a year and day. You can specify the position of the year and day, specify a separator character, and choose between 2-digit and 4-digit year representation. The positions m1 through m3 represent masks used to format the date. To specify the position of the year and day, replace the m1 and m2 positions (in either position) with D for day (001-366) and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year). Replace the m3 position with a separator character. For example, to print the date in the form yyyy/ddd, specify &YDDD=(4D/). For March 29, 2005, the date would appear as 2005/088. Optionally, you can create an offset of the current date. See &DATE [{±}nnnn] for a description. |
&YDDDNS=(m1m2)[{±}nnnn] |
This form of the &YDDDNS subparameter specifies that the current date or date with offset is to appear in the report record in the form of a year and day. You can specify the position of the year and day and choose between 2-digit and 4-digit year representation. The positions m1 and m2 represent masks used to format the date. To specify the position of the year and day, replace the m1 and m2 positions (in either position) with D for day (001-366) and either Y or 4 for the year (where Y is a 2-digit year and 4 is a 4-digit year). For example, to print the date in the form dddyy, specify &YDDDNS=(DY). For March 29, 2005, the date would appear as 08805. Optionally, you can create an offset of the current date. See &DATE [{±}nnnn] for a description. |
&TIME |
The &TIME subparameter specifies the current time of day and requires 8 bytes to display hh:mm:ss, where hh is in 24-hour format. |
&TIME=(hp) |
This form of the &TIME subparameter generates the current time of day and controls the formatting of the time. You can print the time in 24-hour or 12-hour formats and specify the separator character between the hours, minutes, and seconds. The format for 24-hour time is hhpmmpss, where hh represents the hour (00-23), mm represents minutes (00-59), ss represents seconds (00-59), and p represents the separator character as specified by p in the &TIME=hp subparameter. The format for 12-hour time is hhpmmpss nn, where hh represents the hour (01-12), mm represents minutes (00-59), ss represents seconds (00-59), and p represents the separator character as specified by p in the &TIME=hp subparameter. The nn is “am” or “pm” as appropriate. To select 12-hour mode specify h as 12; to select 24-hour mode specify h as 24. The p specification represents the character to use as a separator. For example, to display the time in a 12-hour format with a period as a separator, specify &TIME=(12.). At 22:43:23 hours, the time would appear as “10.43.23 pm”. The field for this form of the &TIME subparameter requires 8 bytes for the 24-hour format and 11 bytes for the 12-hour format. |
&TIMENS=(tt) |
This form of the &TIMENS subparameter specifies that the current time is to appear in the report record in the form 'hhmmss' (24-hour time) or 'hhmmss xx' (12-hour time). If tt is 24, the time is to appear in the form 'hhmmss' (24-hour time) where hh represents the hour (00-23), mm represents the minutes (00-59), and ss represents the seconds (00-59). For example, &TIMENS=(24) would produce a time of the form 'hhmmss' which at 08:25:13 pm would appear as '202513'. If tt is 12, the time is to appear in the form 'hhmmss xx' (12-hour time) where hh represents the hour (01-12), mm represents the minutes (00-59), ss represents the seconds (00-59), and xx is either ‘am’ or ‘pm’. For a second example, &TIMENS=(12) would produce a time of the form 'hhmmss xx' which at 08:25:13 pm would appear as '082513 pm'. |
&PAGE |
The &PAGE subparameter sequentially numbers logical pages of the output report and requires 6 bytes. It produces a 6-digit sequential page number, right justified with leading zeros suppressed. |
&PAGE=(…) |
This subparameter is similar to the &PAGE subparameter except that a 15-digit page number will be provided for display with editing or conversion to another data format. The following describes the &PAGE subparameters that control
format conversion or printable display with edit:
|
TOTAL/TOT |
Use the TOTAL subparameter to specify that numeric data are to be accumulated and totaled at the end of a report, logical page, or section. After the results are included in the appropriate trailer, the accumulator resets to zero. TOTALs either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. If an MFX editing mask is used for totaled data, the default length of the output field is determined by the specified length of the input field and its format. Internally, MFX maintains 31 digits for all data formats, but a totaled number could be bigger than the output field length. For example, a 1 to 4 byte BI or FI field total could exceed 10 digits, or a 1 to 8 byte PD field total or 1 to 15 byte ZD field total could exceed 15 digits. Thus, if your totals could be that large, you should specify the LENGTH and/or EDIT subparameters to override the length of the output field. The following table indicates the length that is used. |
|
SUBTOTAL/SUB |
Use the SUBTOTAL subparameter to generate a running total of a field at the end of a report, logical page, or section. This subparameter functions like the TOTAL subparameter except the accumulator does not reset to zero. SUBTOTALs either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. If an MFX editing mask is used for subtotaled data, the default length of the output field is determined by the specified length of the input field and its format. Internally, MFX maintains 31 digits for all numeric data formats, but a totaled number could be bigger than the output field length. For example, a 1 to 4 byte BI or FI field total could exceed 10 digits, or a 1 to 8 byte PD field total or 1 to 15 byte ZD field total could exceed 15 digits. Thus, if your totals could be that large, you should specify the LENGTH and/or EDIT subparameters to override the length of the output field. Output Display Lengths for TOTAL and SUBTOTAL indicates the length that is used. |
MIN |
Use the MIN subparameter to obtain the minimum numeric value of an input field for all records within the report, logical page, or section. MINs either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
SUBMIN |
Use the SUBMIN subparameter to obtain the running minimum numeric value of an input field for all records within the report up to the point of the TRAILER. SUBMINs either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
MAX |
Use the MAX subparameter to obtain the maximum numeric value of an input field for all records within the report, logical page, or section. MAX values either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
SUBMAX |
Use the SUBMAX subparameter to obtain the running maximum numeric value of an input field for all records within the report up to the point of the TRAILER. SUBMAX values either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
AVG |
Use the AVG subparameter to obtain the average numeric value of an input field for all records within the report, logical page, or section. AVG values either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
SUBAVG |
Use the SUBAVG subparameter to obtain the running average numeric value of an input field for all records within the report up to the point of the TRAILER. SUBAVG values either appear in printable format or can be converted to BI, CSF/FS, FD, FI, PD, or ZD formats. For more information, see fo. |
p |
Use the p subparameter to indicate the position of the first byte of the numeric field. |
l |
Use the l subparameter to indicate the length of the numeric field. Permissible lengths are 1-8 bytes for BI or FI, 4 or 8 bytes for FL, 1-16 bytes for PD, 1-31 bytes for ZD, 1-44 bytes for SFF, UFF, ASF, or AUF with a 31-digit limit, and 1-32 bytes for CSF or FS with a 31-digit limit. To determine the length of the output field for (SUB)MIN, (SUB)MAX, and (SUB)AVG, see How to Convert Numeric Data. For the (SUB)TOTAL and (SUB)AVG functions, fields are totaled internally as 16-byte PD fields. An overflow condition will occur if the positive or negative value of a totaled or subtotaled field exceeds the value that can be represented by such fields, and the execution will terminate with an error message. |
f |
Use the f subparameter to indicate the format of the numeric field. Replace f with BI, CSF, FI, FL, FS, PD, SFF, UFF, or ZD. |
f o |
Use this subparameter to define the output numeric data format |
TO=fo |
of an expression. When fo is specified, mask Mm, EDIT, and SIGNS cannot be specified. Indicate the desired format of the output field by replacing fo with BI, CSF/FS, FD, FI, PD, or ZD. See How to Convert Numeric Data for the default lengths of these fields. See LENGTH=n Subparameter for how this default may be changed. TO=fois equivalent to fo and in general, there is no reason to use the TO= form. However, if you are using a data dictionary symbol in your control statement, you should use the TO=fo form to avoid ambiguities with certain types of data conversions. See the sectionINREC, OUTREC, OUTFIL TO Subparameter. |
Mm |
Use the Mm subparameter to indicate that one of the 27 MFX-supplied masks (M0-M26) should be used to format a field. Replace m with the mask number. The default is M0. For details, refer to LENGTH=n Subparameter. |
EDIT=(pattern) |
Use the EDIT=(pattern) subparameter to indicate that a user-provided editing mask should be used to format a field. For details, see EDIT Subparameter. |
SIGNS=(...) |
Use the SIGNS subparameter to specify leading and/or trailing signs that will appear before or after the edited number. For details, refer to SIGNS Subparameter. |
LENGTH=(n) |
Use the LENGTH subparameter to alter the length of a field determined by the edit pattern and the internal field format. For details, refer to LENGTH=n Subparameter. |
COUNT |
Use the COUNT subparameter to obtain a count of the number of records in either the entire report or a specific part of the report. In a TRAILER1, this field will contain a count of the total number of data records in the report. In a TRAILER2, it will contain a count of the number of data records on each page. In a TRAILER3, it will contain a count of the number of data records in each section. The count will be the number of data records before any multiline OUTREC processing has been done. This number will be a right-justified 8-digit field with leading zeros suppressed. The maximum value is 99999999. |
|
This subparameter is identical to the COUNT subparameter except that a 15-digit count will be produced for display with editing or conversion to another data format. If the +/-nnn subparameter is specified, the nnn value will be added or subtracted from the count before display or conversion. Only 3 digits may be specified for nnn. The following sections describe the COUNT subparameters that control format conversion or printable display with edit: |
COUNT15 |
This subparameter is identical to the COUNT subparameter except for the allowable size of the count number. For COUNT15 the number will be a right-justified 15-digit field with leading zeros suppressed. The maximum value is 999999999999999. |
SUBCOUNT |
Use the SUBCOUNT subparameter to obtain a running, or cumulative, count of the number of records throughout a report. In a TRAILER1, this field will contain a count of the total number of data records in the report. In a TRAILER2, it will contain a cumulative count of the number of data records on a page-by-page basis. In a TRAILER3, it will contain a cumulative count of the number of data records on a section-by-section basis. The count will be the number of data records before any multiline OUTREC processing has been done. This number will be a right-justified, 8-digit field with leading zeros suppressed. The maximum value is 99999999. |
SUBCOUNT=(...) |
This subparameter is identical to the SUBCOUNT subparameter except that a 15-digit count will be produced for display with editing or conversion to another data format. The following sections describe the SUBCOUNT subparameters that control format conversion or printable display with edit: |
SUBCOUNT15 |
This subparameter is identical to the SUBCOUNT subparameter except for the allowable size of the count number. For SUBCOUNT15 the number will be a right-justified 15-digit field with leading zeros suppressed. The maximum value is 999999999999999. |