| Free-Form Syntax | (not allowed – use the %DATE, %TIME, and %TIMESTAMP built-in functions) |
| Code | Factor 1 | Factor 2 | Result Field | Indicators | ||
|---|---|---|---|---|---|---|
| TIME | Target field | |||||
The TIME operation accesses the system time of day and/or the system date at any time during program processing. The system time is based on the 24-hour clock.
The Result field can specify one of the following into which the time of day or the time of day and the system date are written:
| Result Field | Value Returned | Format |
| 6-digit Numeric | Time | hhmmss |
| 12-digit Numeric | Time and Date | hhmmssDDDDDD |
| 14-digit Numeric | Time and Date | hhmmssDDDDDDDD |
| Time | Time | Format of Result |
| Date | Date | Format of Result |
| Timestamp | Timestamp | *ISO |
If the Result field is a numeric field, to access the time of day only, specify the result field as a 6-digit numeric field. To access both the time of day and the system date, specify the result field as a 12- (2-digit year portion) or 14-digit (4-digit year portion) numeric field. The time of day is always placed in the first six positions of the result field in the following format:
If the Result field is a numeric field, then if the system date is included, it is placed in positions 7 through 12 or 7 through 14 of the result field. The date format depends on the date format job attribute DATFMT and can be mmddyy, ddmmyy, yymmdd, or Julian. The Julian format for 2-digit year portion contains the year in positions 7 and 8, the day (1 through 366, right-adjusted, with zeros in the unused high-order positions) in positions 9 through 11, and 0 in position 12. For 4-digit year portion, it contains the year in positions 7 through 10, the day (1 through 366, right-adjusted, with zeros in the unused high-order positions) in positions 11 through 13, and 0 in position 14.
If the Result field is a Timestamp field, the last 3 digits in the microseconds part is always 000.
For more information, see Information Operations.
D Timeres S T TIMFMT(*EUR) D Dateres S D DATFMT(*USA) D Tstmpres S Z *...1....+....2....+....3....+....4....+....5....+....6....+....7...+.... CL0N01Factor1+++++++Opcode(E)+Factor2+++++++Result++++++++Len++D+HiLoEq.... * * When the TIME operation is processed (with a 6-digit numeric * field), the current time (in the form hhmmss) is placed in the * result field CLOCK. The TIME operation is based on the 24-hour * clock, for example, 132710. (In the 12-hour time system, 132710 * is 1:27:10 p.m.) C TIME Clock 6 0 * When the TIME operation is processed (with a 12-digit numeric * field), the current time and day is placed in the result field * TIMSTP. The first 6 digits are the time, and the last 6 digits * are the date; for example, 093315121579 is 9:33:15 a.m. on * December 15, 1979. C TIME TimStp 12 0 C MOVEL TimStp Time 6 0 C MOVE TimStp SysDat 6 0 * This example duplicates the 12-digit example above but uses a * 14-digit field. The first 6 digits are the time, and the last * 8 digits are the date; for example, 13120001101992 * is 1:12:00 p.m. on January 10, 1992. C TIME TimStp 14 0 C MOVEL TimStp Time 6 0 C MOVE TimStp SysDat 8 0 * When the TIME operation is processed with a date field, * the current date is placed in the result field DATERES. * It will have the format of the date field. In this case * it would be in *USA format ie: D'mm/dd/yyyy'. C TIME Dateres * When the TIME operation is processed with a time field, * the current time is placed in the result field TIMERES. * It will have the format of the time field. In this case * it would be in *EUR format ie: T'hh.mm.ss'. C TIME Timeres * When the TIME operation is processed with a timestamp field, * the current timestamp is placed in the result field TSTMPRES. * It will be in *ISO format. * ie: Z'yyyy-mm-dd-hh.mm.ss.mmmmmm' C TIME Tstmpres