IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Removing commas and converting to packed decimal


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Thu Aug 07, 2014 3:49 pm
Reply with quote

Hi,

I have a flat file with the following format
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
8490000000143130 00203140      07200000000030,289,400.97-
8490000000146300 0020314V      050000000000000025,502.49 
8490000000156000 00203140      072000000000000020,369.13-
8490000000163820 00203140      072000000000000003,407.54-
8490000000172550 00106140      072000000000000001,626.99-
8490000000176820 00203140      050000000000000012,921.62 



Pos 38 to 57 is the numeric field which i need to convert to packed decimal and then load this particular field in DECIMAL(15,2) column.

I am not sure how to format this field to packed decimal with the commas and sign at end in input file. I somehow want to format this field to PD and then load to DECIMAL(15,2) column.

Please provide some way if it is possible to do through SORT.
Back to top
View user's profile Send private message
Ramsee

New User


Joined: 06 Jan 2011
Posts: 53
Location: Chennai

PostPosted: Thu Aug 07, 2014 8:17 pm
Reply with quote

Hi Sumit Agarwalla,

Please try the below one :

Code:

//STEP01   EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
8490000000146300 0020314V      050000000000000025,502.49 
8490000000156000 00203140      072000000000000020,369.13-
8490000000163820 00203140      072000000000000003,407.54-
8490000000172550 00106140      072000000000000001,626.99-
8490000000176820 00203140      050000000000000012,921.62 
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  OUTREC FIELDS=(01,37,                                   
                 38,20,ZD,PD,LENGTH=17)                   
/*                                                                                                                 


Kindly let me know if you find an issue in Uploading the field value into your DB2 Table.
Back to top
View user's profile Send private message
sumit agarwalla

New User


Joined: 13 Nov 2008
Posts: 17
Location: hyderabad

PostPosted: Fri Aug 08, 2014 3:57 pm
Reply with quote

Thank You Ramsee!!

I used SFF instead of ZD to get the appropriate output and it got loaded too.

Code:


//STEP01   EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
8490000000146300 0020314V      050000000000000025,502.49 
8490000000156000 00203140      072000000000000020,369.13-
8490000000163820 00203140      072000000000000003,407.54-
8490000000172550 00106140      072000000000000001,626.99-
8490000000176820 00203140      050000000000000012,921.62 
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  OUTREC FIELDS=(01,37,                                   
                 38,20,SFF,PD,LENGTH=17)                   
/*                           
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 08, 2014 10:56 pm
Reply with quote

OK you two. Money out. I want to here it tinkling here.

Why do you have a 17-byte packed-decimal? That would, theoretically, be 33 digits.

I don't know why the source field has leading zeros and optional commas. The larger the number is, the fewer the possible significant digits are.

What about the thing which looks like a trailing sign?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
Search our Forums:

Back to Top