f



Re: 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 *

0
Cathlene
7/5/2005 8:53:58 PM
comp.sys.hp.mpe 25828 articles. 0 followers. rhorner (2) is leader. Post Follow

0 Replies
188 Views

Similar Articles

[PageSpeed] 43

Reply: