DFSORT OUTREC Editing numeric fields

DFSORT OUTREC: Data Conversion DFSORT OUTREC: arithmetic with numeric/constants

Advertisements


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 the edit features 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
-00001
1234
1-
M1TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTS-00123
+00123
00123-
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.56
1234567
-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-3456
12345678
1-234-56788
M7TTT-TT-TTTT 00123456
000-12-3456
12345678
012-34-5678
M8IT:TT:TT030553
3:05:53
121736
12:17:36
M9IT/TT/TT 123004
12/30/04
083104
8/31/04
M10IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIT01234
1234
00000
0
M11TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT00010
00010
01234
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:

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 ********************************

Job:

000100 //Jobcard 
000400 //*                                                                     
000500 //**********************************************************************
000600 //*                                                                     
000700 //* SORT FOR OUTREC STATEMENT                                           
000800 //*                                                                     
000900 //**********************************************************************
001100 //STEP01   EXEC PGM=SORT                                                
001300 //SORTIN   DD DSN=MTHUSER.SORT.INPUT01,DISP=SHR                    
001800 //SORTOUT  DD SYSOUT=*                                                  
001900 //SYSOUT   DD SYSOUT=*                                                  
002400 //SYSIN    DD *                                                         
002411      SORT FIELDS=(1,5,CH,A)                                             
002420      OUTREC FIELDS=(1,39,40,8,ZD,EDIT=(SII,III,IIT),SIGNS=(,-))         
003400 /*                                                                      
****** **************************** 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 Solution:

  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.



DFSORT OUTREC: Data Conversion DFSORT OUTREC: arithmetic with numeric/constants

Advertisements