Conversion to packed decimal



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Conversion to packed decimal

Postby Ramanath » Thu Feb 17, 2011 4:12 pm

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
Ramanath
 
Posts: 7
Joined: Thu Feb 17, 2011 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion to packed decimal

 

Re: Conversion to packed decimal

Postby Robert Sample » Thu Feb 17, 2011 5:26 pm

Write a program to read in each record, convert the amount to packed decimal, and write to a new file.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Conversion to packed decimal

Postby Ramanath » Thu Feb 17, 2011 5:33 pm

I want this through JCL sort
Ramanath
 
Posts: 7
Joined: Thu Feb 17, 2011 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Conversion to packed decimal

Postby Robert Sample » Thu Feb 17, 2011 6:20 pm

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
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Conversion to packed decimal

Postby steve-myers » Thu Feb 17, 2011 7:27 pm

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.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: Conversion to packed decimal

Postby Frank Yaeger » Thu Feb 17, 2011 11:47 pm

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
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post