Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Convert numeric to packed decimal using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Thu Apr 12, 2007 2:25 am    Post subject: Convert numeric to packed decimal using SORT
Reply with quote

I have 3 kinds of records in my file - type 10, type 20 and type 30. Type of record is present in the first 2 bytes of the record. I have a single type 30 record that contains a numeric of 8 bytes with leading zeros compressed starting from position 3 till position 10 in the record. My task is to convert this 8 byte numeric field into a packed decimal of 5 bytes, thats S9(9) comp-3. I just need to convert the type 30 record. The remaining type 10 and type 20 records need not be converted. I would prefer to use sort (PGM=SORT) if possible.

Thanks in advance !

Sample data in the file looks like:

Code:

101999-12-30-23.38.22.113649 
205319390000001016       DV ....NN   
209000001360121007       BP ....YN   
206111210000001014       BP ....YN   
30     104                           
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 12, 2007 2:52 am    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for. Since you're going from an 8-byte field to a 5-byte field, I overlaid 3 blanks after the 5-byte field.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB)
//SORTOUT DD DSN=... output file (FB))
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,2,CH,EQ,C'30'),
    OVERLAY=(3:3,8,FS,TO=PD,LENGTH=5,3X))
/*
Back to top
View user's profile Send private message
tarunbhardwajleo

New User


Joined: 23 Feb 2007
Posts: 25
Location: Dallas, TX

PostPosted: Thu Apr 12, 2007 3:12 am    Post subject:
Reply with quote

Hi Frank,

Thanks for the reply... Iam sorry, I forgot to mention that our shop doesn't have DFSORT. Can we use the same code using PGM=SORT ? But in that case I think that the overlay parameters might vary.....
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Apr 12, 2007 4:14 am    Post subject:
Reply with quote

Quote:
Can we use the same code using PGM=SORT ?


PGM=SORT or PGM=ICEMAN invoke the sort product at your site (DFSORT, Syncsort, CA-SORT).

I don't know if this will work with Syncsort. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts OC4 in SORT Mohan Kothakota DFSORT/ICETOOL 2 Tue Sep 12, 2017 6:30 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us