View previous topic :: View next topic
|
Author |
Message |
saji123
New User
Joined: 15 Jul 2009 Posts: 19 Location: Chennai
|
|
|
|
Hi,
Can i covert a date from yyyyddd format which is in s9(9) to yyyymmdd format which is in x(8) format.
Thanks |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
if You search the forums with COBOL JULIAN DATE You will find lots of useful posts
remember to click on search for all terms |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
What version/release of COBOL are you using?
If it's OS/VS COBOL or VS/COBOL II, check with your system folks and enquire whether Language Environment (LE) has been installed in the target LPAR. You would then need to use the LE equivilent Callable Date routines of the following DATE INTRINSIC FUNCTIONS.
If it's COBOL/370 (the successor to VS COBOL II) and greater, review the following (feeling generous today) -
Code: |
03 WS-JULIAN-DATE PIC S9(09).
03 WS-GREG-DATE PIC 9(08).
03 WS-GREG-DATE-X REDEFINES WS-GREG-DATE PIC X(08).
MOVE 2009227 TO WS-JULIAN-DATE.
COMPUTE WS-GREG-DATE = (FUNCTION DATE-OF-INTEGER (FUNCTION INTEGER-OF-DAY (WS-JULIAN-DATE))).
|
After the calculation, the value of WS-GREG-DATE-X will equal '20090912'.
Bill |
|
Back to top |
|
|
saji123
New User
Joined: 15 Jul 2009 Posts: 19 Location: Chennai
|
|
|
|
Thank you Bill,
This function is working fine |
|
Back to top |
|
|
|