Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Removing commas and converting to packed decimal

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Removing commas and converting to packed decimal
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: 52
Location: Chennai

PostPosted: Thu Aug 07, 2014 8:17 pm    Post subject:
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    Post subject: Reply to: Removing commas and converting to packed decimal
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Aug 08, 2014 10:56 pm    Post subject: Reply to: Removing commas and converting to packed decimal
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    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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us