The OUTREC control statement reformats the output records. Use the OUTREC control statement to accomplish the following tasks:
-
Delete or repeat segments of the input records.
-
Insert character strings between data fields.
-
Insert binary zeros.
-
Create a sequence number field.
-
Convert numeric data to printable format or to another numeric data format.
-
Perform arithmetic operations (multiplication, division, modulus, addition, subtraction) and minimum and maximum functions with numeric fields and constants. This “horizontal arithmetic” ability complements the “vertical arithmetic” already available with SUM, DUPKEYS, OUTFIL TOTAL, MIN, MAX, and AVG.
-
Convert data to printable hexadecimal format.
-
Translate the case of EBCDIC letters from uppercase to lowercase or lowercase to uppercase, or translate a field based on an ALTSEQ table in effect.
-
Select, realign, and reorder data fields.
-
Convert a variable-length record input file to a fixed-length record output file.
-
Conditionally reformat records.
-
Reformat only selected portions of records.
-
Find and replace character or hexadecimal input constants anywhere in your records with character, hexadecimal, or null output constants.
-
Extract variable-position and variable-length fields from records and place them into fixed-length parsed fields. These parsed fields can then be used in any FIELDS/BUILD/OVERLAY function in which a standard p,l fixed-length field can be used.
-
Insert the current date, current time, or current date with an offset.
-
Convert a field with a Julian date to a Gregorian date.
-
Convert a field with a Gregorian date to a Julian date.
-
Add or subtract units of days to or from an input record date field and create an output record date field in the same format with the same length.
-
Compute the interval between two date values.
The OUTREC parameter of the OUTFIL control statement can also be used to accomplish any of the above tasks. The INREC control statement can also be used to accomplish any of the above tasks except for converting a variable-length record file to a fixed-length record file. The INREC control statement also supports the &MULTIINDD subparameter, which is used to identify the input record’s origin when using the MULTIIN PARM.
Consider these guidelines when deciding whether to use the INREC control statement, the OUTREC control statement, or the OUTREC parameter of the OUTFIL control statement:
-
Use the INREC control statement to delete irrelevant data fields, reformat numeric fields to a shorter length, or combine numeric fields with arithmetic operations and functions. Reducing the size of the input records before they are sorted or merged usually improves performance.
-
Use either the OUTREC control statement or the OUTREC parameter of the OUTFIL control statement to expand the data record, create new numeric fields, realign data fields, convert and edit numeric data, and change from variable-length format to fixed-length format when you are creating one output file.
-
Use the OUTREC control statement when you are creating multiple output files with the same output record formatting.
-
Use the OUTREC parameter of the OUTFIL control statement when you are creating multiple output files with different output record formatting.
-
Use the OUTREC control statement if you need to convert a numeric field to printable format so it can be displayed in an OUTFIL header.
-
Use the OUTREC parameter of the OUTFIL control statement when an E35 exit must process the records first.
-
Use the OUTREC parameter of the OUTFIL control statement when you specify the TOTAL and/or SUBTOTAL subparameters of the TRAILER parameter so that the accumulator(s) can sum numeric fields before they have been converted to readable format and edited.
-
Use the OUTREC parameter of the OUTFIL control statement if you want to use the VLFILL parameter or the n/ subparameter, which are not available on the OUTREC or INREC control statements; they can only be used with the OUTREC parameter of the OUTFIL control statement. For the descriptions of the n/ subparameter and VLFILL parameter, see n/ and VLFILL Parameter (Optional).