Page 1 of 1

Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 4:12 pm
by Ramanath
Hi Folks,
Please advise how to convert the amount fields to packed decimal

The below file contains Header,Detail(starting with M) and trailer(staring with 8) records

***************************** Top of Data ******************************
902162011
M020123 02091 96000-CCCCC CCCCCCCC CCCCCC US XXXXXX XXXX
M020ABC 02090 120082-CCCCC CCCCCCCC CCCCCC US XXXXXX
M021PQR 02093 78426-CCCCC CCCCCCCC CCCCCC US XXXXXX XXX
M022UVW 02094 320000-CCCCC CCCCCCCC CCCCCC US XXXXXX XXXXXX
88888888888800004 614508-
******************************************************************************

Detail(starting with M) records has amount filed from 15th postion to 25th position.This amount needs to be
packed to 5 bytes, the -ve sign should store as D in the last half byte.

Please ask me incase of any questions?
Thanks

Re: Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 5:26 pm
by Robert Sample
Write a program to read in each record, convert the amount to packed decimal, and write to a new file.

Re: Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 5:33 pm
by Ramanath
I want this through JCL sort

Re: Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 6:20 pm
by Robert Sample
Your original post did not mention SORT nor any other method, specifically.

Perhaps you should first learn how to ask a question? http://www.catb.org/~esr/faqs/smart-questions.html

Re: Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 7:27 pm
by steve-myers
Ramanath wrote:I want this through JCL sort

JCL does not sort anything. JCL simply specifies programs to execute and specifies the data the program is to use. A program called by using JCL sorts things.

If you need help with a sort program put this query in the forum for the sort program at your installation, but before you do this read the manual for the sort program your installation uses. We can respond to problems you encounter with the manual, but we cannot, and will not, do your work for you.

Re: Conversion to packed decimal

PostPosted: Thu Feb 17, 2011 11:47 pm
by Frank Yaeger
Ramanath,

It's not clear what exactly you want the output to look like when you replace the 11 byte field with a 5 byte field, but assuming you want the 5-byte PD field in positions 11-15 and 16-25 replaced with blanks, you can use a DFSORT job like the following:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
902162011
M020123  02091     96000-CCCCC CCCCCCCC CCCCCC US XXXXXX XXXX
M020ABC  02090    120082-CCCCC CCCCCCCC CCCCCC US XXXXXX
M021PQR  02093     78426-CCCCC CCCCCCCC CCCCCC US XXXXXX XXX
M022UVW  02094    320000-CCCCC CCCCCCCC CCCCCC US XXXXXX XXXXXX
88888888888800004    614508-
//SORTOUT DD DSN=...  output file
//SYSIN DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'M'),
     OVERLAY=(15:15,11,SFF,TO=PD,LENGTH=5,6X))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080