Example 1
This OUTREC control statement defines a 60-byte record as follows:
-
Four binary zeros are inserted in the first 4 bytes of the record (4Z).
-
The next field begins in position 5. This field began in position 20 before OUTREC processing and is 10 bytes long (5:20,10).
-
Eight blanks are inserted before the next field, which is positioned at byte 23. MFX automatically inserts blanks in the unused positions between fields.
-
The next field begins in position 23. This field began in position 44 before OUTREC processing and is 28 bytes long (23:44,28).
-
Ten blanks are inserted in the last 10 bytes of the record (10X).
Example 2
This OUTREC control statement defines a 70-byte output record as follows:
-
The first field (1,50) begins in position 1. This field began in position 1 before OUTREC processing and is 50 bytes long.
-
The next field (64,4) begins in position 51. This packed decimal field began in position 64 before OUTREC processing and is 4 bytes long. After being converted and edited by editing mask M2 (64,4,PD,M2) the resulting field will be 10 bytes long. However, the number of digits that will actually print will depend on the number of leading zeros, if any, because this mask specifies that only three digits must print whether or not they are leading zeros. Moreover, this mask specifies that a minus sign print after the number if it is negative and a blank print after the number if it is positive.
-
The last field (68,6) begins in position 61. This zoned decimal field began in position 68 before OUTREC processing and is 6 bytes long. The EDIT and SIGNS subparameters (EDIT=($I,IIT.TTS),SIGNS=(,,+,-)) specify a 10-byte field because 4 additional bytes are needed for the dollar sign, the comma, the decimal point and the trailing plus or minus sign. Note that if the first three digits are leading zeros, they will be suppressed.
Example 3
This OUTREC control statement defines a 14-byte output record as follows:
-
The first field (1,10,ZD,PD) begins in position 1. This field was a 10-byte ZD field that began in position 1 before OUTREC processing. It will be converted to a 6-byte PD field in the output record, because 6 bytes are required to contain 10 decimal digits as a PD field.
-
The next field (11,4,FI,ZD) begins in position 7. This field was a 4-byte FI field that began in position 11 before OUTREC processing. It will be converted to an 8-byte ZD field in the output record. Normally 10 ZD bytes would be required to contain the 10 decimal digits that may be represented by a 4-byte FI field, but the LENGTH=8 parameter overrode the output length. If there are more than 8 decimal digits in any of the 11,4,FI fields, those digits will be truncated on the left in the output record.
Note that ZD output is not the same as printable output using editing masks. High order zeros will appear as zeros in a ZD field, while they appear as blanks when using the default M0 mask, as well as most other masks. The sign indicator in a ZD field is placed in the first 4 bits of the rightmost byte, and not as a separate printable sign.
Example 4
This OUTREC example uses arithmetic and function operators to do algebraic calculations.
New 8-byte PD fields are required in each record containing the maximum and average of fields A, B, and C. Another new 5-byte printable field is required containing field D as a percentage of field E. The field definitions are:
|
The OUTREC control statement to accomplish this would be:
This OUTREC control statement defines a 64-byte output record as follows:
-
The first field (1,36) retains the complete contents of the input record.
-
The second output field begins in position 40. An arithmetic calculation is done using three different numeric input fields and the constant +3 to compute the arithmetic average. This is an expression that is considered to contain 15 decimal digits. The output is requested as a PD field. The length of this field will be 8 bytes, since that is the length required to contain 15 decimal digits.
-
The third output field begins in position 50. Multiplying numeric Field D by 100 before dividing by numeric Field E gives the desired percentage number, which is considered to contain 15 decimal digits. No output format or editing mask is specified, so the default mask M0 is used to create printable output. LENGTH=5 is specified to reduce the default length of the output field from 16 to 5, since it is known that the percentage number will not be large.
Example 5
This OUTREC control statement uses DT1, TM1, and edit masks to convert SMF date and time values to appropriate formats.
The following shows how the output would be formatted:
2002/07/04 07:22:122
002/07/04 05:15:25
2002/07/05 11:37:39
2002/07/05 16:42:28
Example 6
This OUTREC control statement illustrates the use of the &DATE1(c) and &TIME1(c) parameters in an MFX run on June 9, 2002 at 04:16:29 p.m.
The output would include data from the input record in the first twenty columns followed by the run-time date and time starting in column 24. The date and time would appear as '2002 06 09 16:16:29'.
Example 7
The following control statements illustrate two of the options of the TRAN subparameter.
This OUTREC control statement uses TRAN=LTOU to translate the letters in positions 1-5 of each output record from lowercase to uppercase.
For example, 'Ab,Cd' would translate to 'AB,CD'.
This OUTREC control statement uses TRAN=ALTSEQ to translate each binary zero (X'00') in columns 1-5 to an asterisk (X'5C') in positions 1-5.
Comprehensive examples illustrating the OUTREC control statement and the OUTREC parameter of the OUTFIL control statement are provided in How to Use the MFX Data Utility Features.