Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
[Solved]converting Integer date extracted from DB2 to 9(8) format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: converting Integer date extracted from DB2 to 9(8) format
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    Post subject: Re: converting Integer date extracted from DB2 to 9(8) forma
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

Site Director


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

PostPosted: Fri Jun 08, 2007 12:27 am    Post subject:
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    Post subject: Re: converting Integer date extracted from DB2 to 9(8) forma
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

Site Director


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

PostPosted: Fri Jun 08, 2007 1:18 pm    Post subject:
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    Post subject: Re: converting Integer date extracted from DB2 to 9(8) forma
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

Site Director


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

PostPosted: Sat Jun 09, 2007 10:14 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 7 Fri Sep 22, 2017 11:35 pm
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Julian Date to CICS ABSTTIME blayek CICS 3 Wed Aug 30, 2017 11:15 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us