Wednesday, December 7, 2011

SORT: How to convert packed decimal to zoned decimal (PD to ZD)

You can use DFSORT's INREC, OUTREC or OUTFIL OUTREC statements to do this kind of conversion. For example, if you had a 4-byte PD field starting in position 1, you could convert it to a 7-byte ZD field as follows:

OPTION COPY
OUTREC FIELDS=(1,4,PD,ZD)

You can use the LENGTH parameter to specify the length you want DFSORT to use for the ZD field. For example

OPTION COPY
OUTREC FIELDS=(1,4,PD,ZD,LENGTH=12)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.