ILE COBOL Language Reference

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


FORMAT Clause

The FORMAT clause specifies the general characteristics and editing requirements of an elementary date, time, or timestamp item.

FORMAT Clause - Format
 
>>-FORMAT--+----+--+-DATE------+--+----+------------------------>
           '-OF-'  +-TIME------+  '-IS-'
                   '-TIMESTAMP-'
 
>--+---------------------------------+-------------------------><
   '-+-literal-2--+--------------+-+-'
     |            '-| phrase 1 |-' |
     '-| phrase 2 |----------------'
 
phrase 1:
 
|--SIZE--+----+--integer-4--+-------------------------------------+--|
         '-IS-'             '-LOCALE--+-------------------------+-'
                                      '-+----+--mnemonic-name-1-'
                                        '-IS-'
 
phrase 2:
 
|--SIZE--+----+--integer-5--LOCALE--+-------------------------+--|
         '-IS-'                     '-+----+--mnemonic-name-2-'
                                      '-IS-'
 
 

The FORMAT clause must be specified for every elementary date, time, or timestamp item, except the subject of a RENAMES clause.

Neither literal-2 nor the SIZE phrase may be specified for a timestamp item. This has a fixed format, which is 26 characters in length and equivalent to a literal-2 value of "@Y-%m-%d-%H.%M.%S.@Sm".

If literal-2 or the LOCALE phrase is not specified for a date or time item, the format of the item is determined from the SPECIAL-NAMES FORMAT clause.

A data item of class date-time cannot be reference modified.

When the FORMAT clause is specified, the following clauses cannot be specified:

The following general rules apply:

literal-2
Specifies the format of a date or time item. Literal-2 must be a non-numeric literal, at least 2 characters long. The contents of literal-2 is made up of separators and conversion specifiers. For a list of valid conversion specifiers, see Table 5. For further rules on the contents of literal-2, see the description of the FORMAT clause used in the SPECIAL-NAMES paragraph in FORMAT Clause.

Related Information


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