View previous topic :: View next topic |
Author |
Message |
Ameen Beginner
Joined: 22 Dec 2004 Posts: 4 Topics: 2
|
Posted: Tue Mar 22, 2005 7:48 pm Post subject: DB2 - Unload |
|
|
Hi,
I have the following field in the DB2 table.
Field1 - X(35)
Field2 - S9(11)V USAGE COMP-3
Field3 - X(11)
Field4 - S9(9) USAGE COMP [this field always contains 2 digit no.]
Field5 - S9(9) USAGE COMP.[this field always contains 2 digit no.]
I want to unload the above fields in to a Dataset in the following format.
Field1 - X(35).
Field2 - 9(9).
Field3 - X(11).
Field4 - 9(2).
Field5 - 9(2).
I know about the unload but the attributes of fields should be in the format mentioned.
Please help me to do the same |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Mar 22, 2005 8:59 pm Post subject: |
|
|
Ameen,
Try this
Code: |
SELECT FIELD1
,SUBSTR(DIGITS(FIELD2),3,9)
,FIELD3
,SUBSTR(CHAR(FIELD4),1,2)
,SUBSTR(CHAR(FIELD5),1,2)
FROM TABLE
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Ameen Beginner
Joined: 22 Dec 2004 Posts: 4 Topics: 2
|
Posted: Wed Mar 23, 2005 12:45 am Post subject: |
|
|
kolusu,
Is there any other way, because Field2 will contain the quantity if we starting with position 3 value will truncate and also can we give above select in the platinum unload control card. |
|
Back to top |
|
 |
bauer Intermediate
Joined: 10 Oct 2003 Posts: 317 Topics: 50 Location: Germany
|
Posted: Wed Mar 23, 2005 1:35 am Post subject: |
|
|
Hi Ameen,
if the unload doesn't accept the select statement (i don't know the meaning of "platinum" unload card ??????) create an view containing the type casting an do the unload using the view. This works.
regards,
bauer |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
|
|