Ü  TEST (Test Date/Time/Timestamp)

·         Test opcode is used to validate a date, time or timestamp.

·         The low level indicator is set on if the date is not valid or set off if the date is a valid one.

·         Test will be given with operator extender like test (d), test (t), test (z) for date, time and time stamp.

·         Test without extended factor default to date (z).

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

TEST(E)

date, time or timestamp

Target string

Error Indicator

 

Example


Columns . . . :    6  80                       Edit                           AMINEM/QRPGLESRC
SEU==>                                                                              DATE_TIME4
FMT D  DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ************************************************************
0001.00 DDATE0            S             10A   INZ('2013-01-01')                         130124
0002.00 DDATE1            S             10A   INZ('2013-21-01')                         130124
0003.00 DFLAG             S              1N                                             130124
0004.00  *                                                                              130124
0005.00 C                   TEST (D)                DATE0                  90           130124
0006.00 C                   EVAL      FLAG=*IN90                                        130124
0007.00 C                   EXSR      CHECKDATE                                         130124
0008.00 C                   TEST (D)                DATE1                  80           130124
0009.00 C                   EVAL      FLAG=*IN80                                        130124
0010.00 C                   EXSR      CHECKDATE                                         130124
0011.00 C                   SETON                                            LR         130124
0012.00  *                                                                              130124
0013.00 C     CHECKDATE     BEGSR                                                       130124
0014.00 C                   IF        FLAG=*ON                                          130124
0015.00 C     'INVALID DATE'DSPLY                                                       130124
0016.00 C                   ELSE                                                        130124
0017.00 C     'VALID DATE'  DSPLY                                                       130124
0018.00 C                   ENDIF                                                       130124
0019.00 C                   ENDSR                                                       130124
      ****************** End of data *********************************************************

 

OUTPUT

VALID DATE          

INVALID DATE        

 

 










User Comments:



Subscribe

  Email:



Copyright © www.go4as400.com, 2013-2017. Copyright notice