OUTREC Editing numeric fields
PD values are stored as integers in a compressed internal format which is unreadable while printing or displaying the values. OUTREC edit feature can be used to insert signs, commas, decimal points, and hyphens, as appropriate, to make the PD values easy to interpret.
OUTREC edit feature can be used on mostly PD values and it edits the numeric fields using the patterns.
Below are the list of patterns used in numeric fields -
- I indicate a leading insignificant digit to be displayed as 1-9, or as blank for a leading 0.
- T indicates a significant digit to be displayed as 0-9.
- S before the digits indicates a leading sign. S after the digits indicates a trailing sign.
- Any other character is just displayed as the same.
Below table provides the cear understanding about each format with example -
Format | Format display | Value passed | Displaying Value |
---|---|---|---|
M0 | IIIIIIIIIIIIIIIIIIIIIIIIIIIIIITS | +01234 -00001 | 1234 1- |
M1 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTS | -00123 +00123 | 00123- 00123 |
M2 | II,III,III,III,III,III,III,III,III,IIT.TTS | +123450 1,234.50 | -000020 0.20- |
M3 | II,III,III,III,III,III,III,III,III,IIT.TTCR | -001234 +123456 | 12.34CR 1,234.56 |
M4 | SII,III,III,III,III,III,III,III,III,IIT.TT | +0123456 -1234567 | +1,234.56 -12,345.67 |
M5 | SII,III,III,III,III,III,III,III,III,IIT.TTS | -001234 +123450 | (12.34) 1,234.50 |
M6 | III-TTT-TTTT | 00123456 12345678 | 012-3456 1-234-56788 |
M7 | TTT-TT-TTTT | 00123456 12345678 | 000-12-3456 012-34-5678 |
M8 | IT:TT:TT | 030553 121736 | 3:05:53 12:17:36 |
M9 | IT/TT/TT | 123004 083104 | 12/30/04 8/31/04 |
M10 | IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT | 01234 000000 | 1234 |
M11 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT | 00010 01234 | 00010 01234 |
M12 | SI,III,III,III,III,III,III,III,III,III,IIT | +1234567 -0012345 | 1,234,567 -12,345 |
M13 | SI.III.III.III.III.III.III.III.III.III.IIT | +1234567 -0012345 | 1.234.567 -12.345 |
M14 | SI III IIIIIIIIIIIIIIIIIIIIIIII IITS | +1234567 -0012345 | 1 234 567 (12 345) |
M15 | I III IIIIIIIIIIIIIIIIIIIIIIII IITS | +1234567 -0012345 | 1 234 567 12 345- |
M16 | SI III IIIIIIIIIIIIIIIIIIIIIIII IIT | +1234567 -0012345 | 1 234 567 -12 345 |
M17 | SI'III'III'III'III'III'III'III'III'III'IIT | +1234567 -0012345 | 1'234'567 -12'345 |
M18 | SII,III,III,III,III,III,III,III,III,IIT.TT | +0123456 -1234567 | 1,234.56 -12,345.67 |
M19 | SII.III.III.III.III.III.III.III.III.IIT,TT | +0123456 -1234567 | 1.234,56 -12.345,67 |
M20 | SI III IIIIIIIIIIIIIIIIIIIII IIT,TTS | +0123456 -1234567 | 1 234,56 (12 345,67) |
M21 | II III IIIIIIIIIIIIIIIIIIIII IIT,TTS | +0123456 -1234567 | 1 234,567 12 345,67- |
M22 | SI III IIIIIIIII IIII III IIIIII IIT,TT | +0123456 -1234567 | 1 234,56 -12 345,67 |
M23 | SII'III'III'III'III'III'III'III'III'IIT.TT | +0123456 -1234567 | 1'234.56 -12'345.67 |
M24 | SII'III'III'III'III'III'III'III'III'IIT,TT | +0123456 -1234567 | 1'234,56 -12'345,67 |
M25 | SIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT | +01234 -00001 | 1234 -1 |
M26 | STTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT | 1234 -1 | +01234 -00001 |
Examples -
Scenario1 - Editing a zoned decimal field with commas and decimal points.
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,10,11,5,ZD,M11,LENGTH=10)
/*
Edits the 5-byte zoned decimal field starting at position 11 by applying the M11 mask, which formats the number with commas and decimal points. The edited field will have a total length of 10 characters.
Scenario2 - Editing a packed decimal field to include a leading sign.
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,10,15,4,PD,M11,LENGTH=8)
/*
Edits the 4-byte packed decimal field starting at position 15 by using the M11 mask to include commas, a decimal point, and a sign. The result will be an 8-character formatted field.
Scenario3 - Formatting a binary field with leading zeros.
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,10,20,4,BI,M0,LENGTH=6)
/*
Formats the 4-byte binary field starting at position 20, with a M0 mask to include leading zeros, making the final field 6 characters long.