Thanks to everybody who responded.
Cathlene's suggested trick worked and now I am able to get the Julian date
in the format that I was looking for inside the cobol program itself. Thanks
again.
Raghu Rao
Preferred Care - IS
-----Original Message-----
From: Cathlene Mc Rae [mailto:[log in to unmask]]
Sent: Tuesday, July 05, 2005 4:54 PM
To: [log in to unmask]
Subject: Re: [HP3000-L] On Topic : Cobol question.
Your question:
However, I could not find any information related to extracting current date
in Julian format (YYDDD). Is there anything directly that can be achieved
from this FUNCTION or any other function ? My only alternative so far is to
code a logic for converting above Gregorian to Julian date format and then
use in the COBOL program.
,,,,,,
To get the date format of julian or gregorian ...The hpdateconvert intrinsic
can be used. http://docs.hp.com/en/32650-90875/ch07s09.html
Sample code for this can be found in itrc, KBRC00015373
You can also use:
INTEGER-OF-DATE and DATE-OF-INTEGER. Function INTEGER-OF-DATE converts a
date in YYYYMMDD format to an integer date equivalent, starting with January
1, 1601, of the Gregorian calendar. Function DATE-OF-INTEGER does the
opposite, converting an integer date to its standard date equivalent.
INTEGER-OF-DATE
INTEGER-OF-DAY
DATE-OF-INTEGER
DAY-OF-INTEGER
$control POST85
IDENTIFICATION DIVISION.
PROGRAM-ID. PROG.
AUTHOR.
DATE-WRITTEN.
DATE-COMPILED. SAME.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 GREGORIAN-DATE PIC S9(8) BINARY.
77 DATE-OF-INT PIC S9(8) BINARY.
77 DAY-OF-INT PIC S9(8) BINARY.
77 INT-OF-DATE PIC S9(8) BINARY.
77 INT-OF-DAY PIC S9(8) BINARY.
PROCEDURE DIVISION.
ONLY-PARA.
DISPLAY 'INPUT DATE IN FORMAT YYYYMMDD'.
ACCEPT GREGORIAN-DATE FREE.
DISPLAY 'THE DATE ENTERED WAS: ' GREGORIAN-DATE.
COMPUTE INT-OF-DATE =
FUNCTION INTEGER-OF-DATE (GREGORIAN-DATE).
DISPLAY 'INTEGER-OF-DATE RETURNED: ' INT-OF-DATE.
COMPUTE DAY-OF-INT =
FUNCTION DAY-OF-INTEGER (INT-OF-DATE).
DISPLAY 'DAY-OF-INTEGER RETURNED: ' DAY-OF-INT.
COMPUTE INT-OF-DAY =
FUNCTION INTEGER-OF-DAY (DAY-OF-INT).
DISPLAY 'INTETGER-OF-DAY RETURNED: ' INT-OF-DAY.
COMPUTE DATE-OF-INT =
FUNCTION DATE-OF-INTEGER (INT-OF-DAY).
DISPLAY 'DATE-OF-INTEGER RETURNED: ' DATE-OF-INT.
STOP RUN.
Sample run of the program:
INPUT DATE IN FORMAT YYYYMMDD
20050705
THE DATE ENTERED WAS: +20050705
INTEGER-OF-DATE RETURNED: +00147744
DAY-OF-INTEGER RETURNED: +02005186
INTETGER-OF-DAY RETURNED: +00147744
DATE-OF-INTEGER RETURNED: +20050705
hope this helps
Best Regards
Cathlene Mc Rae
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
www.preferredcare.org
"An Outstanding Member Experience," Preferred Care HMO Plans -- J. D. Power and Associates
Confidentiality Notice:
The information contained in this electronic message is intended for the exclusive use of the individual or entity named above and may contain privileged or confidential information. If the reader of this message is not the intended recipient or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that dissemination, distribution or copying of this information is prohibited. If you have received this communication in error, please notify the sender immediately by telephone and destroy the copies you received.
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|