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 

Copying DB2 smallint field to a flat file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
whizkid79
Beginner


Joined: 29 Sep 2004
Posts: 53
Topics: 14

PostPosted: Mon Oct 04, 2004 2:14 pm    Post subject: Copying DB2 smallint field to a flat file Reply with quote

Hi,

I know that a DB2 smallint field, is stored in binary format in dataset. We cant see the value unless we do a hex on. I have a rexx program the reads a DB2 smallint field. But while copying that to a file, it's converted to char format. I tried D2X in rexx as well as in DB2, but of no use. Please let me know how I can copy a DB2 smallint field as binary to a flat file, so that i can use a copybook to view the file contents properly.

Thanks.
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Mon Oct 04, 2004 2:49 pm    Post subject: Reply with quote

whiizkid79,
did you try casting the field. Like SELECT DIGITS(DB2 smallint field), it should give you numeric values. Thanks
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: Mon Oct 04, 2004 2:51 pm    Post subject: Reply with quote

Did you try B2X? Check this link for a detailed explanation of B2X

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4A330/4.3.8?DT=20020521161835

Btw You can use CHAR or DIGITS functions to reprenst the integer data in character format.

Check this link for CHAR and DIGITS functions.

CHAR Scalar Funtion

DIGITS Scalar Funtion

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
whizkid79
Beginner


Joined: 29 Sep 2004
Posts: 53
Topics: 14

PostPosted: Mon Oct 04, 2004 5:11 pm    Post subject: Reply with quote

Hi Kolusu,

I'l be more specific. I have a DB2 smallint field having value = 2. When extracted to a dataset it will be visible as dots(..). This is a 2 byte field and on doing a HEX ON, i'll be getting the hexadecimal value of 2. But when i do the above process, the value 2 is getting displayed instead of the dots in the file. Now when i use fileaid to view the structure of the file (using a copybook), the values are not matching, because instead of the hex value, 2 is getting displayed. By requirement is to place the dots in the file while querying the smallint field from DB2, so that when i do a HEX ON, I'll be seeing the hx value of 2.

Am i clear now?
Back to top
View user's profile Send private message
Cogito-Ergo-Sum
Advanced


Joined: 15 Dec 2002
Posts: 637
Topics: 43
Location: Bengaluru, INDIA

PostPosted: Tue Oct 05, 2004 2:52 am    Post subject: Reply with quote

Quote:
I have a DB2 smallint field having value = 2. When extracted to a dataset it will be visible as dots(..). This is a 2 byte field and on doing a HEX ON, i'll be getting the hexadecimal value of 2. But when i do the above process, the value 2 is getting displayed instead of the dots in the file.


I do not get the above part.

Just curious. But, what do you observe with a value of say, 3000 (decimal) ?
_________________
ALL opinions are welcome.

Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes.
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 Oct 05, 2004 4:35 am    Post subject: Reply with quote

whizkid79,

I am still confused with your request. If you want the value in hex then DB2 has the function HEX

Check this link for scalar function hex

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DSNSQH11/3.2.33?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 -> TSO and ISPF 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