View previous topic :: View next topic
|
Author |
Message |
pranabbiswas
New User
Joined: 03 Jun 2007 Posts: 3 Location: Irvine,USA
|
|
|
|
- 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 |
|
|
bansal
New User
Joined: 03 Jan 2007 Posts: 27 Location: Hyderabad
|
|
|
|
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 |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
pranabbiswas
New User
Joined: 03 Jun 2007 Posts: 3 Location: Irvine,USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome
And might this
Quote: |
Then moved it to the target field with Pic 9(80).
|
have been Pic 9(8)? |
|
Back to top |
|
|
pranabbiswas
New User
Joined: 03 Jun 2007 Posts: 3 Location: Irvine,USA
|
|
|
|
Yes, you are right. It was a typo.
Was moved to 9(8).
Thanks a lot! |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome |
|
Back to top |
|
|
|