MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DB2 - Unload

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
Ameen
Beginner


Joined: 22 Dec 2004
Posts: 4
Topics: 2

PostPosted: Tue Mar 22, 2005 7:48 pm    Post subject: DB2 - Unload Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 22, 2005 8:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Ameen
Beginner


Joined: 22 Dec 2004
Posts: 4
Topics: 2

PostPosted: Wed Mar 23, 2005 12:45 am    Post subject: Reply with quote

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
View user's profile Send private message
bauer
Intermediate


Joined: 10 Oct 2003
Posts: 317
Topics: 50
Location: Germany

PostPosted: Wed Mar 23, 2005 1:35 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 23, 2005 4:40 am    Post subject: Reply with quote

Quote:

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



If your specs need only 9 bytes in the output and if your data exceeds that you would truncate it anyway. Check this link for digits function.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.27?SHELF=&DT=20010718164132&CASE=

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group