OUTREC: Editing numeric fields
OUTREC: Editing numeric fields
Summary
OUTREC used to edit the numeric fields to display in the proper understandable format.
PD values are stored as integers in a compressed internal format which is actually unreadable while printing or displaying the values.
OUTREC edit feature can use 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. OUTREC edits the numeric fields using the patterns.
The 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 same.
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-000020 | 1,234.50 0.20- |
M3 | II,III,III,III,III,III,III,III,III,IIT.TTCR | 001234 12.34CR | +123456 1,234.56 |
M4 | SII,III,III,III,III,III,III,III,III,IIT.TT | +0123456 +1,234.56 | 1234567-12,345.67 |
M5 | SII,III,III,III,III,III,III,III,III,IIT.TTS | -001234 (12.34) | +123450 1,234.50 |
M6 | III-TTT-TTTT | 00123456 012-3456 | 123456781-234-56788 |
M7 | TTT-TT-TTTT | 00123456 000-12-3456 | 12345678012-34-5678 |
M8 | IT:TT:TT | 030553 3:05:53 | 12173612:17:36 |
M9 | IT/TT/TT | 123004 12/30/04 | 0831048/31/04 |
M10 | IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT | 01234 1234 | 000000 |
M11 | TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT | 00010 00010 | 01234 01234 |
M12 | SI,III,III,III,III,III,III,III,III,III,IIT | +1234567 1,234,567 | -0012345 -12,345 |
M13 | SI.III.III.III.III.III.III.III.III.III.IIT | +1234567 1.234.567 | -0012345 -12.345 |
M14 | SI III IIIIIIIIIIIIIIIIIIIIIIII IITS | +1234567 1 234 567 | -0012345 (12 345) |
M15 | I III IIIIIIIIIIIIIIIIIIIIIIII IITS | +1234567 1 234 567 | -0012345 12 345- |
M16 | SI III IIIIIIIIIIIIIIIIIIIIIIII IIT | +1234567 1 234 567 | -0012345 -12 345 |
M17 | SI'III'III'III'III'III'III'III'III'III'IIT | +1234567 1'234'567 | -0012345 -12'345 |
M18 | SII,III,III,III,III,III,III,III,III,IIT.TT | +0123456 1,234.56 | -1234567 -12,345.67 |
M19 | SII.III.III.III.III.III.III.III.III.IIT,TT | +0123456 1.234,56 | -1234567 -12.345,67 |
M20 | SI III IIIIIIIIIIIIIIIIIIIII IIT,TTS | +0123456 1 234,56 | -1234567 (12 345,67) |
M21 | II III IIIIIIIIIIIIIIIIIIIII IIT,TTS | +0123456 1 234,567 | -1234567 12 345,67- |
M22 | SI III IIIIIIIII IIII III IIIIII IIT,TT | +0123456 1 234,56 | -1234567 -12 345,67 |
M23 | SII'III'III'III'III'III'III'III'III'IIT.TT | +0123456 1'234.56 | -1234567 -12'345.67 |
M24 | SII'III'III'III'III'III'III'III'III'IIT,TT | +0123456 1'234,56 | -1234567 -12'345,67 |
M25 | SIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT | +01234 1234 | -00001 -1 |
M26 | STTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT | 1234 +01234 | -1 -00001 |
Example -
Scenario - Edit the marks from input file as M12(SII,III,IIT).
Input File - MTHUSER.SORT.INPUT01 - FB file of 80 length
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
00001 student1 dept1 00000560
00003 student3 dept2 00000520
00004 student4 dept1 00000540
00005 student5 dept2 00000500
00002 student2 dept3 00000510
******************************** Bottom of Data ********************************
JCL -
000100 //Jobcard ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//*
//**********************************************************************
//*
//* SORT FOR OUTREC STATEMENT
//*
//**********************************************************************
//STEP01 EXEC PGM=SORT
//SORTIN DD DSN=MTHUSER.SORT.INPUT01,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
OUTREC FIELDS=(1,39,40,8,ZD,EDIT=(SII,III,IIT),SIGNS=(,-))
/*
**************************** Bottom of Data ****************************
Output -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* TOP OF DATA **********************************
00001 student1 dept1 560
00002 student2 dept3 510
00003 student3 dept2 520
00004 student4 dept1 540
00005 student5 dept2 500
******************************** BOTTOM OF DATA ********************************
Explaining Example -
- OUTREC FIELDS=(1,39,..) copies first 39 bytes from input file to output as it is.
- OUTREC FIELDS=(..,40,8,ZD,EDIT=(SII,III,IIT),SIGNS=(,-)) converts the 8 digit ZD to M12(SII,III,IIT) and displays sign only for negative values.
Note! In the above example, the numeric value was not displayed like 000,000,520 because it has all zeroes before. So the format was ignored and displayed only 520.
It also not displaying the sign as the values are positive.