IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

[Solved]converting Integer date extracted from DB2 to 9(8) format


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pranabbiswas

New User


Joined: 03 Jun 2007
Posts: 3
Location: Irvine,USA

PostPosted: Thu Jun 07, 2007 11:26 am
Reply with quote

- I extracted DB2 date defined as INTEGER in a sequential file.
- Found that the the date is stored in 4 bytes as hexadecimal format. When I used calculator to convert it from hex to decimal it displays as 9(8) date e.g 20010718.
- If I want to move this hex date to a field defined in cobol as 9(8) or X(8) to display the date as the above format as converted by the calculator. How can I do that in a COBOL program.
I would appreciate any help in this regard
Thanks, Pranab
Back to top
View user's profile Send private message
bansal

New User


Joined: 03 Jan 2007
Posts: 27
Location: Hyderabad

PostPosted: Thu Jun 07, 2007 12:33 pm
Reply with quote

Hi,

First of all, if u use copybook created by DCLGEN, u dont need to worry about it. Bcoz it will take the standard settings. And the standard format of DATE in COBOL is 10 bytes but not 8 bytes.

If u want it in 8 bytes, u can extract the Db2 date in 10 bytes and from there u can extract the 8 bytes to a variable.

Hope this helps icon_biggrin.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 08, 2007 12:27 am
Reply with quote

Hello,

Try to MOVE it to a field defined as PIC 9(8) and display that result field.

Please post your variables and the move/display if it does not work the way you want.
Back to top
View user's profile Send private message
pranabbiswas

New User


Joined: 03 Jun 2007
Posts: 3
Location: Irvine,USA

PostPosted: Fri Jun 08, 2007 7:43 am
Reply with quote

Thanks for your help.
I have defined the variable as Pic 9(8) Binary
Then moved it to the target field with Pic 9(80).
That resolved my problem.
It displayed as ccyymmdd format.
Thanks,
Pranab
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 08, 2007 1:18 pm
Reply with quote

You're welcome icon_smile.gif

And might this
Quote:
Then moved it to the target field with Pic 9(80).
have been Pic 9(8)?
Back to top
View user's profile Send private message
pranabbiswas

New User


Joined: 03 Jun 2007
Posts: 3
Location: Irvine,USA

PostPosted: Sat Jun 09, 2007 9:32 am
Reply with quote

Yes, you are right. It was a typo.
Was moved to 9(8).

Thanks a lot!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Jun 09, 2007 10:14 am
Reply with quote

You're welcome icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top