sortingjcl

How to move s9(12)v9(2) to x(15) in jcl sort card


I wanted to move field s9(16)v9(2) sign leading separate to x(50) using sort card in jcl. I'm not sure of the options available in sort.Direct sort copy,gives wrong display and the decimal point is also ignored in the o/p destination.can you please give some inputs.


Solution

  • Have a look at your sort product's user's guide. Search for the OUTREC statement. You have complete control over the data that appears in the output records, and how it is formatted using the EDIT option.

    As a sample, assume the input record(s) has(have) a packed decimal field of length 5 bytes in position 10, and you want the data to be shown as d,ddd,ddd.dd in the output:

    SORT     FIELDS=COPY                                
    OUTREC   BUILD(1:10,5,PD,EDIT=('I,III,III.TT'))   
    END                                                 
    

    You didn't specify what format that input number internally has, i.e. you didn't specify the COMP attribute of the COBOL declaration. You may or may not have meant it to be in packed decimal format. I'm sure you will be able to adapt my example to your concrete case.