OUTREC: Editing numeric fields


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 displayValue passed Displaying Value
M0IIIIIIIIIIIIIIIIIIIIIIIIIIIIIITS+01234 -000011234 1-
M1TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTS-00123 +0012300123-00123
M2II,III,III,III,III,III,III,III,III,IIT.TTS +123450-000020 1,234.50 0.20-
M3II,III,III,III,III,III,III,III,III,IIT.TTCR001234 12.34CR+123456 1,234.56
M4SII,III,III,III,III,III,III,III,III,IIT.TT +0123456 +1,234.561234567-12,345.67
M5SII,III,III,III,III,III,III,III,III,IIT.TTS-001234 (12.34)+123450 1,234.50
M6III-TTT-TTTT 00123456 012-3456123456781-234-56788
M7TTT-TT-TTTT 00123456 000-12-345612345678012-34-5678
M8IT:TT:TT030553 3:05:5312173612:17:36
M9IT/TT/TT 123004 12/30/040831048/31/04
M10IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT01234 1234000000
M11TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT00010 0001001234 01234
M12SI,III,III,III,III,III,III,III,III,III,IIT +1234567 1,234,567 -0012345 -12,345
M13SI.III.III.III.III.III.III.III.III.III.IIT +1234567 1.234.567-0012345 -12.345
M14SI III IIIIIIIIIIIIIIIIIIIIIIII IITS +1234567 1 234 567-0012345 (12 345)
M15I III IIIIIIIIIIIIIIIIIIIIIIII IITS +1234567 1 234 567-0012345 12 345-
M16SI III IIIIIIIIIIIIIIIIIIIIIIII IIT+1234567 1 234 567-0012345 -12 345
M17SI'III'III'III'III'III'III'III'III'III'IIT+1234567 1'234'567-0012345 -12'345
M18SII,III,III,III,III,III,III,III,III,IIT.TT+0123456 1,234.56-1234567 -12,345.67
M19SII.III.III.III.III.III.III.III.III.IIT,TT+0123456 1.234,56-1234567 -12.345,67
M20SI III IIIIIIIIIIIIIIIIIIIII IIT,TTS +0123456 1 234,56-1234567 (12 345,67)
M21II III IIIIIIIIIIIIIIIIIIIII IIT,TTS +0123456 1 234,567-1234567 12 345,67-
M22SI III IIIIIIIII IIII III IIIIII IIT,TT +0123456 1 234,56-1234567 -12 345,67
M23SII'III'III'III'III'III'III'III'III'IIT.TT +0123456 1'234.56-1234567 -12'345.67
M24SII'III'III'III'III'III'III'III'III'IIT,TT+0123456 1'234,56-1234567 -12'345,67
M25SIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT +01234 1234 -00001 -1
M26STTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT 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 -

  1. OUTREC FIELDS=(1,39,..) copies first 39 bytes from input file to output as it is.
  2. 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.