HP3000-L Archives

February 2001, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Franck LERAY <[log in to unmask]>
Reply To:
Date:
Tue, 20 Feb 2001 16:58:21 +0100
Content-Type:
text/plain
Parts/Attachments:
text/plain (152 lines)
Here it is...
*---------------------------------------------------------------
*   Date    Storage     Bytes   Explanation
*   Type    Type
*   Code
*---------------------------------------------------------------
*   1       longint     8       micro-seconds since 1970-01-01
*   2       integer     4       Upper 2 bytes : year
*                               Next byte     : month of year
*                               Next byte     : day   of month
*   3       integer     4       Upper 2 bytes : year
*                               bottom byte   : day   of year
*   4       integer     4       Upper 23 bits : #years since 1900
*                               bottom 9 bits : day of year
*                               (analogous to the existing
*                               CALENDAR format)
*   10      integer     4       Seconds since 1970-01-01
*                               (POSIX.1 time() format:
*                               valid through 2038-01-18)
*   14      shortint    2       Upper 7 bits  : #years since 1900
*                               Lower 9 bits  : day of the year
*                               (CALENDAR format : valid up to
*                               2027-12-31)
*   15      integer     4       YYMMDD   date
*   16      integer     4       MMDDYY   date
*   17      integer     4       DDMMYY   date
*   18      integer     4       YYYYMMDD date
*   25      ASCII       6       YYMMDD   date
*   26      ASCII       6       MMDDYY   date
*   27      ASCII       6       DDMMYY   date
*   35      ASCII       6       YYMMDD   date YY:MM3000 date
*   36      ASCII       6       MMDDYY   date YY:MM3000 date
*   37      ASCII       6       DDMMYY   date YY:MM3000 date
*   38      ASCII       8       YYYYMMDD date
*---------------------------------------------------------------
*
*HPDATEVALIDATE
*
*NM callable only.
*This intrinsic checks the validity of the given date with respect
*to the supported formats given in the table,
*"Supported Date Formats."
*Syntax
* I32                        I32V       *        I32V
*result := HPDATEVALIDATE (datecode, inputdate, cutoff)
*
*Parameters
*
*datecode is a 32 bit signed integer by value
*The value should be one of the date type codes listed in the
*table, "Supported Date Formats."

*inputdate is the input date.
* The interpretation depends on the value of datecode
*See the table,"Supported Date Formats," for the supported date
*codes and their layouts.

*cutoff is a 32 bit signed integer by value (optional).
*This is used in validating the input parameter when the input
*date hastwo-digit year. This is a required parameter for dates
*with two-digit years. In all other cases, this parameter is
*ignored.
*If the cutoff parameter is given as -1, the value of the CI
*environment variable HPSPLITYEAR is used as the cutoff year.
*This parameter's value should be in the range 0..100. If the
*value of the parameter is 50, two digit years in the range
*0..49 will translate to 2000..2049 and those in the range
*50..99 will be translated to 1950..1999. If you specify the
*cutoff year as 70, the mapping will be 0..69 as 2000..2069 and
*70..99 as 1970..1999.

*result is a 32 bit signed integer (assigned functional return).
*This value will be 0 if the inputdate conforms to the date format
*represented by datecode. If is is not so, its value will be
* positive. If an error has occurred in evaluating the conformance
*, its value will be negative.
*This return value ranges from -999 to 1.

 01 W-RESULT   PIC S9(09) COMP.
 01 W-DATECODE PIC S9(09) COMP.
 01 W-DATE-15-TEST            PIC S9(09) COMP VALUE 991205.
 01 W-DATE-38-TEST            PIC  X(08)      VALUE "19991205".
 01 W-DATE-25-TEST            PIC  X(06)      VALUE "991205".
 01 W-DATE-27-TEST            PIC  X(06)      VALUE "051299".

 01 W-DATE-TEST               PIC X(8) VALUE "XXXXXXXX".
*==========================================================
*         P R O C E D U R E     D I V I S I O N           *
*==========================================================

 PROCEDURE DIVISION.

 DEBUT.
    MOVE 15                   TO W-DATECODE.
    MOVE 0                    TO W-RESULT.
    CALL INTRINSIC "HPDATEVALIDATE" USING  W-DATECODE
                                           W-DATE-15-TEST
                                           \-1\
                                    GIVING W-RESULT.
    DISPLAY W-RESULT.

*   The date is OK w-result = 0

    MOVE 15                   TO W-DATECODE.
    MOVE 0                    TO W-RESULT.
    CALL INTRINSIC "HPDATEVALIDATE" USING  W-DATECODE
                                           W-DATE-25-TEST
                                           \-1\
                                    GIVING W-RESULT.
    DISPLAY W-RESULT.

*   the date is not ok w=result = 1

    MOVE 25                   TO W-DATECODE.
    MOVE 0                    TO W-RESULT.
    CALL INTRINSIC "HPDATEVALIDATE" USING  W-DATECODE
                                           W-DATE-25-TEST
                                           \-1\
                                    GIVING W-RESULT.
    DISPLAY W-RESULT.

*   The date is OK w-result = 0

    MOVE 25                   TO W-DATECODE.
    MOVE 0                    TO W-RESULT.
    CALL INTRINSIC "HPDATEVALIDATE" USING  W-DATECODE
                                           W-DATE-TEST
                                           \-1\
                                    GIVING W-RESULT.
    DISPLAY W-RESULT.
*   the date is not ok w=result = 1


    MOVE "20100101" TO W-DATE-TEST.
    MOVE 38                   TO W-DATECODE.
    MOVE 0                    TO W-RESULT.
    CALL INTRINSIC "HPDATEVALIDATE" USING  W-DATECODE
                                           W-DATE-TEST
                                           \-1\
                                    GIVING W-RESULT.
    DISPLAY W-RESULT.
*   The date is OK w-result = 0
_________________________________________________________

Franck LERAY / CHEOPS Technology France S.A
Chef de projet
1, Impasse des Jades ; BP 83883 ; 44338 Nantes Cedex 3
tél : +33 (0)2 51 13 23 33 ; gsm +33 (0)6 62 72 02 27 ; fax: +33 (0)2 51 13
23 39
email: [log in to unmask]
_________________________________________________________

ATOM RSS1 RSS2