DATABASE DATE FORMAT AND SEPARATOR (EDIT CHARACTER)


To specify the format for a date field, use the DDS keyword DATFMT, as follows:

       DATFMT( *JOB | *MDY | *YMD | *DMY | *ISO | *USA | *EUR | *JIS | *JUL ) 

The DDS DATFMT keyword accepts the date format codes listed in Table C.1.

Any of the formats listed in Table C.1 can be specified for a date field in a database file. When DATFMT(*JOB) is specified, the date format is based on the DATFMT of the OS/400 job that is running when the database file is created.

The date format represents how the date is presented to the user. The length of a date field includes the date separator and is 6, 8, or 10 characters in length. The date separator is used to edit the date value. The formats *MDY, *DMY, *YMD, and *JUL support the five separators listed in Table C.1. The slash ('/') is the default separator for these date formats. The date formats *ISO, *USA, *EUR, and *JIS have a fixed separator. Therefore, the DATSEP keyword is not valid for date fields of this format.

Date Separator Keyword

To specify a separator other than the default separator, use the DATSEP keyword. The DATSEP keyword accepts one parameter, as follows:

       DATSEP( *JOB | 'date separator' ) 

The date separator parameter is a quoted character and is used to edit a date field where the format is *MDY, *YMD, *DMY, or *JUL. The valid date separator symbols include:

/

(the slash)

-

(the minus)

.

(the period)

,

(the comma)

&

(the ampersand, for blank)

Optionally, DATSEP(*JOB) can be specified to indicate that the separator is based on the DATSEP value of the OS/400 job that is running when the database file is created.

The date format, including the date separator, is known as the external format. This format is used by all system interfaces to display and manipulate date values. In fact, the length of the field in the database is based on date format and not the internal format. The internal format is the format in which a date value is stored within the database file object. This internal format is not accessible through any high-level system interfaces. SQL, Query Manager, and all high-level languages such as RPG work only with the external format of date fields.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net