Subject: | |
From: | |
Reply To: | |
Date: | Wed, 8 Feb 2006 14:41:39 -0800 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Some years ago HP introduced a series of functions that can be called from
COBOL to handle dates. Below is a copy of a 'test' routine that I wrote
back then to try them out. I think there is a function that returns the
difference of two dates.
Regards
Paul Christidis
$CONTROL LIST ,post85
IDENTIFICATION DIVISION.
PROGRAM-ID. 'COBDSUBS'.
AUTHOR. Paul H. Christidis
DATE-WRITTEN. 07/14/97.
DATE-COMPILED.
REMARKS.
Test program to demonstate the different
date related functions that are now available
in cobol.
NOTE: The compiler control keyword 'POST85' MUST
be specified as one of the '$CONTROL' options in
order for the date functions to be enabled.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE-COMPUTER. HP3000.
OBJECT-COMPUTER. HP3000.
INPUT-OUTPUT SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 old-today pic x(8).
01 full-date.
05 c-date pic 9(8).
05 c-time pic 9(8).
05 c-time-diff.
10 c-gmt-dir pic x.
10 c-hour pic 99.
10 c-minutes pic 99.
01 int-date pic 9(8).
01 future-date pic 9(8).
LINKAGE SECTION.
PROCEDURE DIVISION.
0000-START.
display "Subroutine".
move current-date to old-today.
display "Old Today = ", old-today.
move function current-date to full-date.
display "New Today = ", full-date.
compute int-date = function integer-of-date (c-date).
display "Integer Today= ", int-date.
add 998 to int-date.
compute future-date = function date-of-integer (int-date).
display "Future day = ", future-date.
GOBACK.
The above produces the following:
Old Today = 02/08/06
New Today = 2006020814340100-0800
Integer Today= 00147962
Future day = 20081102
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|
|
|