f



On Topic : Cobol question.

Hi all,=20

We have been regularly using the FUNCTION CURRENT-DATE in COBOL to fetch =
the
runtime date and time inside the cobol programs as listed below :=20

           MOVE FUNCTION CURRENT-DATE      TO WS-CURRENT-DATE-TIME.

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.=20

Any help is greatly appreciated.=20

TIA
Raghu Rao

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 *

0
Rao
7/5/2005 7:35:42 PM
comp.sys.hp.mpe 25828 articles. 0 followers. rhorner (2) is leader. Post Follow

2 Replies
206 Views

Similar Articles

[PageSpeed] 41

Cathlene's suggestion would work. It really isn't that hard to calculate day
of year (search Raven for past discussions of why what Raghu asks for is *
not * a Julian date, and that this confusion is IBM's fault). It's so
straightforward that the OS gives it to us for free as HPDOY. While you are
getting system variables, get HPYEAR, HPYYYY, HPYYYYMMDD or HPDATETIME, and
manipulate as needed to get the YY part.

Stefan points to functions, which do work with the actual Julian Date. But
this is not what Raghu is asking for.

Greg Stigers

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

0
Greg
7/5/2005 9:55:49 PM
"Rao, Raghu"  wrote:

> I could not find any information related to extracting current date
> in Julian format (YYDDD).

If, as you imply, you only need two digits for the year, the easiest way to
do this is with an ACCEPT statement.  If you want to use the CURRENT-DATE
function you can, but it takes more work.

Both methods are standard COBOL.  The CURRENT-DATE function has been in
COBOL for fifteen years.  The ACCEPT ... FROM DAY syntax has been around for
at least twice that long.

The following program demonstrates both techniques.

Walter

-----cut here
$CONTROL POST85
 IDENTIFICATION DIVISION.
 PROGRAM-ID. COBTEST.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01  WS-YYDDD        PIC 9(5).
 01  DATE-YYYYMMDD   PIC 9(8).
 01  DATE-INTEGER    PIC 9(7).
 01  DATE-YYYYDDD    PIC 9(7).
 PROCEDURE DIVISION.
 MAIN.
     PERFORM EASY-METHOD
     PERFORM HARDER-METHOD
     STOP RUN.
 EASY-METHOD.
     ACCEPT WS-YYDDD FROM DAY
     DISPLAY WS-YYDDD
     CONTINUE.
 HARDER-METHOD.
     MOVE FUNCTION CURRENT-DATE (1:8) TO DATE-YYYYMMDD
     COMPUTE DATE-INTEGER =
             FUNCTION INTEGER-OF-DATE (DATE-YYYYMMDD)
     COMPUTE DATE-YYYYDDD =
             FUNCTION DAY-OF-INTEGER (DATE-INTEGER)
     MOVE DATE-YYYYDDD (3:5) TO WS-YYDDD
     DISPLAY WS-YYDDD
     CONTINUE.
 END PROGRAM COBTEST.
-----cut here-----



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
0
Walter
7/6/2005 9:42:56 PM
Reply: