ILE COBOL Language Reference

+-------------------------------IBM Extension--------------------------------+


TEST-DATE-TIME

The TEST-DATE-TIME function takes a date, time, or timestamp item; alphanumeric item; numeric packed or zoned item; and determines if it is a valid date, time or timestamp. It returns true (B'1') if it is a valid item or false (B'0') if it is not a valid item.

The function type is boolean.

The length of the returned value is 1 byte.

Format
 
>>-FUNCTION TEST-DATE-TIME-------------------------------------->
 
>--(--argument-1--+--------------------------------------------+--)-><
                  '-argument-2--+----------------------------+-'
                                '-argument-3--+------------+-'
                                              '-argument-4-'
 
 

argument-1
Can be:

If argument-1 is a date, time, or timestamp item, then argument-2 through argument-4 are optional. If argument-1 is not a date, time, or timestamp item, argument-2 must be specified (argument-3 and argument-4 are optional).

Argument-1 is tested to see if it is a valid item, based on its type or on argument-2 through argument-4.

argument-2
Must be one of the following keywords:

If argument-2 is TIMESTAMP, neither argument-3 nor argument-4 can be specified.

argument-3
Specifies the format of a date or time item. It must be:

For a list of valid literals see the SPECIAL-NAMES FORMAT clause.

If argument-3 is the keyword LOCALE, then the format of the date or time is based on a LOCALE. If argument-4 is not specified, the current locale is used, otherwise the locale associated with the mnemonic-name or the LOCALE OF special register is used.

If argument-3 is not specified, the format used for the test is the one defined in the SPECIAL-NAMES FORMAT clause.

argument-4
Must be a mnemonic-name associated with a LOCALE, or the LOCALE OF special register.

Argument-4 must follow these rules:

Related Information


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]