SORT – OUTREC – INSERT ZEROES, BLANKS, STRINGS
Using OUTREC parameter in SORT, you can insert zeroes, blanks or strings in any place you require of the output record.
-
Insert Zeroes
Suppose you want to copy first 10 fields then place 10 zeroes and then bytes from 11 to 20 from the input file to output file. Your OUTREC would look like as below.
OUTREC FIELDS=(1,10,10Z,11,10)
Where 10Z means 10 Zeroes
-
Insert Blanks
Suppose you want to copy first 10 fields then place 10 blanks and then bytes from 11 to 20 from the input file to output file. Your OUTREC would look like as below.
OUTREC FIELDS=(1,10,10X,11,10)
Where 10X means 10 Blanks
The above OUTREC can also be written as below:
OUTREC FIELDS=(1,10,21:11,10)
Where 21: would ask the sort to fill the data from 11 to 20 bytes of input into 21 to 30 of the output dataset. SORT will automatically fill in blanks from 11 to 20.
Specifying c:X as your last field is an easy way to increase the record length of your output records to c bytes. For example, if you want to create 80-byte output records containing the first 30 bytes of your input records padded with blanks, you can use this OUTREC statement:
OUTREC BUILD=(1,30,80:X)
-
Insert string
To insert character strings use the below format
OUTREC FIELDS=(1,10,C’AT LAST’)
Here we are inserting the string ‘AT LAST’ once after copying first 10 chars of input record.
OUTREC FIELDS=(1,10,5C’AT LAST’)
Here we are inserting the string ‘AT LAST’ five times after copying first 10 chars of input record.
To insert hexadecimal strings use the below format
OUTREC FIELDS=(1,10,X’yy..yy’)
Here we are inserting the string ‘yy..yy’ once after copying first 10 chars of input record.
OUTREC FIELDS=(1,10,nX’yy..yy’)
Here we are inserting the string ‘yy..yy’ five times after copying first 10 chars of input record.
——————————————————————————————————–
In United States, If you would like to Earn Free Stocks, Credit card Points and Bank account Bonuses, Please visit My Finance Blog
——————————————————————————————————–
You may also like to look at:
Working on Mainframes – Is Change to a different technology necessary