|
View previous topic :: View next topic
|
| Author |
Message |
sumit agarwalla
New User
Joined: 13 Nov 2008 Posts: 17 Location: hyderabad
|
|
|
|
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 |
|
 |
Ramsee
New User
.jpg)
Joined: 06 Jan 2011 Posts: 53 Location: Chennai
|
|
|
|
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 |
|
 |
sumit agarwalla
New User
Joined: 13 Nov 2008 Posts: 17 Location: hyderabad
|
|
|
|
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 |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|