JCL- Sort ‘PD’ to ‘ZD’ with Length Calculation

I am giving here simple sort card. This if need you can elaborate it. In many occasions, we need data in Zoned decimal. If we convert data into ZD, then, we can see the data in the file.

Example-1

//sysin  DD  *

SORT FIELDS=COPY

INCLUDE COND=(1,5,PD,EDIT(TTTTTTT.TT))

/*

Example-2

//sysin  DD  *

SORT FIELDS=COPY

INCLUDE COND=(1,5,PD,TO=ZD,LENGTH=9)

/*

So the EDIT will give the way, how to display it of packed decimal. I am just giving: SORT FIELDS=COPY is equal to OPTION COPY. Calculation for length: PD= 5 bytes Length=((2 x PD) -1) =  (2x 5) -1 = 9 bytes.

One comment

Comments are closed.