For support of date, time, and timestamp, the external data format that is used is a character string. Associated with this character string will be a data definitional attribute list (DDAT) that describes all the attributes of the string.
The attributes that are associated with the character string are as follows:
The following table describes the possible conversions for date/time
data.
Source Operand | Result Operand |
---|---|
DATE | DATE, PseudoDATE, PseudoPackedDATE, or PseudoZonedDATE |
TIME | TIME or PseudoTIME |
TIMESTAMP | TIMESTAMP or PseudoTIMESTAMP |
PseudoDATE | DATE or PseudoDATE |
PseudoPackedDATE or PseudoZonedDATE | DATE |
PseudoTIME | TIME or PseudoTIME |
PseudoTIMESTAMP | TIMESTAMP or PseudoTIMESTAMP |
For all Date/Time arithmetic, Increment, Decrement, and Compute, there must be at least one non-zero DDAT number specified between operand 1, operand 2, and the result.
DDATs are equivalent when both DDAT numbers are 0 or both DDAT numbers are non-zero and the DDATs they reference are byte for byte identical.
End of month adjustment can only be specified in conjunction with Date and Timestamp arithmetic that involves the incrementing and decrementing of Dates or Timestamps.
When end of month adjustment is specified, there must be at least one non-internal format specified for operand 1, operand 2, or the result. When end of month adjustment is not specified all durations must reference a DDAT that specifies a year and month definition other than zero.
The following describes the Data Definitional Attribute Template
(DDAT).
Offset | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dec | Hex |
| Field Name |
| Data Type and Length | ||||||||
0 | 0 |
| Data definitional attribute template (optional) |
| [*] Char(112-N) | ||||||||
|
|
|
(repeated for each operand/field that requires a template, one template
can be used by multiple operands/fields that have the same attributes)
| ||||||||||
0 | 0 |
| DDAT length (ignored) |
| UBin(2) | ||||||||
2 | 2 |
| Format code |
| UBin(2) | ||||||||
4 | 4 |
| Separator definition |
| Char(2) | ||||||||
4 | 4 |
| Date separator type |
| Char(1) | ||||||||
5 | 5 |
| Time separator type |
| Char(1) | ||||||||
6 | 6 |
| Time zone definition |
| Char(4) | ||||||||
6 | 6 |
| Hour zone |
| UBin(2) | ||||||||
8 | 8 |
| Minute zone |
| UBin(2) | ||||||||
10 | A |
| Duration definitions |
| Char(4) | ||||||||
10 | A |
| Month definition |
| UBin(2) | ||||||||
12 | C |
| Year definition |
| UBin(2) | ||||||||
14 | E |
| Century definition |
| Char(8) | ||||||||
14 | E |
| Current century |
| UBin(4) | ||||||||
18 | 12 |
| Century division |
| UBin(4) | ||||||||
22 | 16 |
| Calendar table offset |
| UBin(4) | ||||||||
26 | 1A |
| Reserved (binary 0) |
| Char(6) | ||||||||
32 | 20 |
| Era table template |
| Char(50-n) | ||||||||
* | * |
| Calendar table template |
| Char(18-n) | ||||||||
* | * |
| --- End --- |
|
|
The following table describes the operand type and DDAT field
associations.
Operand Type | Format Code | Date Separator | Time Separator | Time Zone | Month Definition | Year Definition | Century | Era Table | Calendar Table | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Date | REQ | REQ | INV | INV | INV | INV | REQ | REQ | REQ | ||||||
Time | REQ | INV | REQ | REQ | INV | INV | INV | INV | INV | ||||||
Timestamp | REQ | REQ | REQ | REQ | INV | INV | REQ | REQ | REQ | ||||||
Pseudo Date | REQ | REQ | INV | INV | INV | INV | REQ | REQ | REQ | ||||||
Pseudo Packed Date | REQ | INV | INV | INV | INV | INV | REQ | REQ | REQ | ||||||
Pseudo Zoned Date | REQ | INV | INV | INV | INV | INV | REQ | REQ | REQ | ||||||
Pseudo Time | REQ | INV | REQ | REQ | INV | INV | INV | INV | INV | ||||||
Pseudo Timestamp | REQ | REQ | REQ | REQ | INV | INV | REQ | REQ | REQ | ||||||
Date Duration | REQ | INV | INV | INV | EMA | EMA | INV | INV | INV | ||||||
Time Duration | REQ | INV | INV | INV | INV | INV | INV | INV | INV | ||||||
Timestamp Duration | REQ | INV | INV | INV | EMA | EMA | INV | INV | INV | ||||||
Year Label Duration | REQ | INV | INV | INV | EMA | EMA | INV | INV | INV | ||||||
Month Label Duration | REQ | INV | INV | INV | EMA | EMA | INV | INV | INV | ||||||
Day Label Duration | REQ | INV | INV | INV | EMA | EMA | INV | INV | INV | ||||||
Hour Label Duration | REQ | INV | INV | INV | INV | INV | INV | INV | INV | ||||||
Minute Label Duration | REQ | INV | INV | INV | INV | INV | INV | INV | INV | ||||||
Second Label Duration | REQ | INV | INV | INV | INV | INV | INV | INV | INV | ||||||
Microsecond Label Duration | REQ | INV | INV | INV | INV | INV | INV | INV | INV | ||||||
Note:
The DDAT length is the length of the DDAT in bytes. This field is ignored by the instruction. |
The following table describes the format code.
The formats are used to
define the representation or interpretation of data across the MI.
They also imply the length of the data, some of the minimum lengths
can only be utilized when a null date or time separator has been
specified.
Format Type | Format Code | Minimum Input Length | Maximum Input Length | Minimum Output Length | Maximum Output Length |
---|---|---|---|---|---|
USA date | Hex 0001 | 8 | n | 10 | n |
USA time | Hex 0002 | 4 | n | 8 | n |
ISO date | Hex 0003 | 8 | n | 10 | n |
ISO time | Hex 0004 | 4 | n | 8 | n |
EUR date | Hex 0005 | 8 | n | 10 | n |
EUR time | Hex 0006 | 4 | n | 8 | n |
JIS date | Hex 0007 | 8 | n | 10 | n |
JIS time | Hex 0008 | 4 | n | 8 | n |
SAA® timestamp | Hex 0009 | 16 | n | 26 | n |
System internal date | Hex 000A | 4 | 4/n # | 4 | 4/n # |
System internal time | Hex 000B | 3 | 3/n # | 3 | 3/n # |
System internal timestamp | Hex 000C | 10 | 10/n # | 10 | 10/n # |
Labeled duration YEAR | Hex 000D | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration MONTH | Hex 000E | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration DAY | Hex 000F | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration HOUR | Hex 0010 | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration MINUTE | Hex 0011 | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration SECOND | Hex 0012 | 15,0 | 15,0 | 15,0 | 15,0 |
Labeled duration MICROSECOND | Hex 0013 | 15,0 | 15,0 | 15,0 | 15,0 |
Date duration | Hex 0014 | 8,0 | 8,0 | 8,0 | 8,0 |
Time duration | Hex 0015 | 6,0 | 6,0 | 6,0 | 6,0 |
Timestamp duration | Hex 0016 | 20,6 | 20,6 | 20,6 | 20,6 |
*MMDDYY | Hex 0017 | 6 | n | 6 | n |
*DDMMYY | Hex 0018 | 6 | n | 6 | n |
*YYMMDD | Hex 0019 | 6 | n | 6 | n |
*YYDDD | Hex 001A | 5 | n | 5 | n |
*HHMMSS | Hex 001B | 4 | n | 6 | n |
System clock | Hex 001C | 8 | 8 | 8 | 8 |
*YYYYDDD | Hex 001D | 7 | n | 7 | n |
*YYYYMMDDhhmmss | Hex 001E | 14 | n | 14 | n |
*Unknown date | Hex 001F | 4 | n | F | n |
*Unknown time | Hex 0020 | 3 | n | F | n |
*Unknown timestamp | Hex 0021 | 10 | n | F | n |
*MMDDYY(packed) | Hex 0022 | 6,0 | 7,0 | 6,0 | 7,0 |
*DDMMYY(packed) | Hex 0023 | 6,0 | 7,0 | 6,0 | 7,0 |
*YYMMDD(packed) | Hex 0024 | 6,0 | 7,0 | 6,0 | 7,0 |
*CMMDDYY(packed) | Hex 0025 | 7,0 | 7,0 | 7,0 | 7,0 |
*CDDMMYY(packed) | Hex 0026 | 7,0 | 7,0 | 7,0 | 7,0 |
*CYYMMDD(packed) | Hex 0027 | 7,0 | 7,0 | 7,0 | 7,0 |
*MMDDYYYY(packed) | Hex 0028 | 8,0 | 9,0 | 8,0 | 9,0 |
*DDMMYYYY(packed) | Hex 0029 | 8,0 | 9,0 | 8,0 | 9,0 |
*YYYYMMDD(packed) | Hex 002A | 8,0 | 9,0 | 8,0 | 9,0 |
*YYMM(packed) | Hex 002B | 4,0 | 5,0 | 4,0 | 5,0 |
*MMYY(packed) | Hex 002C | 4,0 | 5,0 | 4,0 | 5,0 |
*YYYYMM(packed) | Hex 002D | 6,0 | 7,0 | 6,0 | 7,0 |
*MMYYYY(packed) | Hex 002E | 6,0 | 7,0 | 6,0 | 7,0 |
*YYDDD(packed) | Hex 002F | 5,0 | 5,0 | 5,0 | 5,0 |
*YYYYDDD(packed) | Hex 0030 | 7,0 | 7,0 | 7,0 | 7,0 |
*MMDDYY(zoned) | Hex 0031 | 6,0 | 6,0 | 6,0 | 6,0 |
*DDMMYY(zoned) | Hex 0032 | 6,0 | 6,0 | 6,0 | 6,0 |
*YYMMDD(zoned) | Hex 0033 | 6,0 | 6,0 | 6,0 | 6,0 |
*CMMDDYY(zoned) | Hex 0034 | 7,0 | 7,0 | 7,0 | 7,0 |
*CDDMMYY(zoned) | Hex 0035 | 7,0 | 7,0 | 7,0 | 7,0 |
*CYYMMDD(zoned) | Hex 0036 | 7,0 | 7,0 | 7,0 | 7,0 |
*MMDDYYYY(zoned) | Hex 0037 | 8,0 | 8,0 | 8,0 | 8,0 |
*DDMMYYYY(zoned) | Hex 0038 | 8,0 | 8,0 | 8,0 | 8,0 |
*YYYYMMDD(zoned) | Hex 0039 | 8,0 | 8,0 | 8,0 | 8,0 |
*YYMM(zoned) | Hex 003A | 4,0 | 4,0 | 4,0 | 4,0 |
*MMYY(zoned) | Hex 003B | 4,0 | 4,0 | 4,0 | 4,0 |
*YYYYMM(zoned) | Hex 003C | 6,0 | 6,0 | 6,0 | 6,0 |
*MMYYYY(zoned) | Hex 003D | 6,0 | 6,0 | 6,0 | 6,0 |
*YYDDD(zoned) | Hex 003E | 5,0 | 5,0 | 5,0 | 5,0 |
*YYYYDDD(zoned) | Hex 003F | 7,0 | 7,0 | 7,0 | 7,0 |
Note:
|
The following table defines which
data types are supported by a format code and which formats
will be used when trying to determine the format of an unknown date, time, or timestamp value.
Format Type | Format Code | Preferred Format | Search List | Supported data type |
---|---|---|---|---|
USA date | Hex 0001 | Y | Y | Character |
USA time | Hex 0002 | Y | Y | Character |
ISO date | Hex 0003 | Y | Y | Character |
ISO time | Hex 0004 | Y | Y | Character |
EUR date | Hex 0005 | Y | Y | Character |
EUR time | Hex 0006 | Y | Y | Character |
JIS date | Hex 0007 | Y | Y | Character |
JIS time | Hex 0008 | Y | Y | Character |
SAA timestamp | Hex 0009 | Y | Y | Character |
System internal date | Hex 000A | Y | N | Character,Date |
System internal time | Hex 000B | Y | N | Character,Time |
System internal timestamp | Hex 000C | Y | N | Character,Timestamp |
Labeled duration YEAR | Hex 000D |
|
| Packed |
Labeled duration MONTH | Hex 000E |
|
| Packed |
Labeled duration DAY | Hex 000F |
|
| Packed |
Labeled duration HOUR | Hex 0010 |
|
| Packed |
Labeled duration MINUTE | Hex 0011 |
|
| Packed |
Labeled duration SECOND | Hex 0012 |
|
| Packed |
Labeled duration MICROSECOND | Hex 0013 |
|
| Packed |
Date duration | Hex 0014 |
|
| Packed |
Time duration | Hex 0015 |
|
| Packed |
Timestamp duration | Hex 0016 |
|
| Packed |
*MMDDYY | Hex 0017 | Y | N | Character |
*DDMMYY | Hex 0018 | Y | N | Character |
*YYMMDD | Hex 0019 | Y | N | Character |
*YYDDD | Hex 001A | Y | N | Character |
*HHMMSS | Hex 001B | Y | N | Character |
System clock | Hex 001C | Y | N | Character |
*YYYYDDD | Hex 001D | Y | Y | Character |
*YYYYMMDDhhmmss | Hex 001E | Y | Y | Character |
*Unknown date | Hex 001F |
|
| Character |
*Unknown time | Hex 0020 |
|
| Character |
*Unknown timestamp | Hex 0021 |
|
| Character |
*MMDDYY(packed) | Hex 0022 | N | N | Packed |
*DDMMYY(packed) | Hex 0023 | N | N | Packed |
*YYMMDD(packed) | Hex 0024 | N | N | Packed |
*CMMDDYY(packed) | Hex 0025 | N | N | Packed |
*CDDMMYY(packed) | Hex 0026 | N | N | Packed |
*CYYMMDD(packed) | Hex 0027 | N | N | Packed |
*MMDDYYYY(packed) | Hex 0028 | N | N | Packed |
*DDMMYYYY(packed) | Hex 0029 | N | N | Packed |
*YYYYMMDD(packed) | Hex 002A | N | N | Packed |
*YYMM(packed) | Hex 002B | N | N | Packed |
*MMYY(packed) | Hex 002C | N | N | Packed |
*YYYYMM(packed) | Hex 002D | N | N | Packed |
*MMYYYY(packed) | Hex 002E | N | N | Packed |
*YYDDD(packed) | Hex 002F | N | N | Packed |
*YYYYDDD(packed) | Hex 0030 | N | N | Packed |
*MMDDYY(zoned) | Hex 0031 | N | N | Zoned |
*DDMMYY(zoned) | Hex 0032 | N | N | Zoned |
*YYMMDD(zoned) | Hex 0033 | N | N | Zoned |
*CMMDDYY(zoned) | Hex 0034 | N | N | Zoned |
*CDDMMYY(zoned) | Hex 0035 | N | N | Zoned |
*CYYMMDD(zoned) | Hex 0036 | N | N | Zoned |
*MMDDYYYY(zoned) | Hex 0037 | N | N | Zoned |
*DDMMYYYY(zoned) | Hex 0038 | N | N | Zoned |
*YYYYMMDD(zoned) | Hex 0039 | N | N | Zoned |
*YYMM(zoned) | Hex 003A | N | N | Zoned |
*MMYY(zoned) | Hex 003B | N | N | Zoned |
*YYYYMM(zoned) | Hex 003C | N | N | Zoned |
*MMYYYY(zoned) | Hex 003D | N | N | Zoned |
*YYDDD(zoned) | Hex 003E | N | N | Zoned |
*YYYYDDD(zoned) | Hex 003F | N | N | Zoned |
Note:
The preferred format column lists the format codes that can be suggested as the first format to try when attempting to determine the format of an unknown date, time, or timestamp value. The search list column lists the format codes and their associated format that will be used when trying to determine the format of an unknown date, time, or timestamp value. Only those formats marked as allowed in the search list will be used when trying to determine the format of an unknown date, time, or timestamp value; none of the other formats are used in this process. |
The following are the descriptions of the formats, D represents days, M represents months, Y represents years, C represents century, h represents hours, m represents minutes, s represents seconds and u represents microseconds.
The following describes the separator definitions for date and time. The separator type is a one character field that contains the separator value, for example, :, ., /, or -. When the format has an implied separator, the implied separator is used. For example: for an ISO date, the implied separator is '-'. When the format does not have an implied separator, the implied separator is null. For example, the format *YYMMDD has an implied separator of null. A null separator means the units of time, year, month, day, etc..., are concatenated together. A implied separator is specified by using the value of hex 00. A null separator is specified by using the value of hex FF. A null separator is invalid for the SAA formats, USA, ISO, etc... Any other separator value overrides the implied value for the format code.
The following describes the time zone definition. The hour zone value is 0 to 24. GMT zone is 0. The zone to the east of zone 0 is zone 1. The zone to the east of zone 1 is zone 2, and so on. The value 24 specifies that the time is to be stored as local time and that the concept of time zones should be ignored. The value of 24 is required for storage purposes. For example, when inserting a time field into a database data space the hour zone value must be 24. A value other than 24 can be used for retrieval purposes.
The minute zone value is 0 to 60. GMT zone is 0. The zone to the west of zone 0 is zone 1. The zone to the west of zone 1 is zone 2, and so on. The value 60 specifies that the time is to be stored as local time and that the concept of time zones should be ignored. The value of 60 is required for storage purposes. For example, when inserting a time field into a database data space the minute zone value must be 60. A value other than 60 can be used for retrieval purposes.
The month definition is an integer number of days. For example, 30 would specify that each month used in a duration would have a constant value of 30 days. A value of zero specifies that the calendar definition of the month should be used.
The year definition is an integer number of days. For example, 365 would specify that each year used in a duration would have a constant value of 365 days. A value of zero specifies that the calendar definition of the year should be used.
When end of month adjustment arithmetic is being performed, the month definition and year definition must have zero values. When no end of month adjustment arithmetic is being performed, the month definition and year definition must have non-zero values. Otherwise a template value invalid (hex 3801) exception will be signaled.
The century definition is used to define the century when a two digit year is specified for a date. The definition is two numbers, one for current century and the other is for the century division year. The current century is a century number. The century division is a year number. The valid values for the current century are 00 - 99 followed by a 00 suffix. The valid values for the century division are 00 - 99. The century division is included in the current century. For example, a current century of 1900 and a century division of 50 would result in two digit years 00 - 49 having the values 2000 - 2049 and 50 - 99 having values 1950 - 1999. If the specified format has a century guard digit or a four digit year then the current century field value is ignored.
The calendar table offset is the number of bytes from the start of the DDAT to the start of the calendar table (described below).
The era table immediately follows the fixed portion of the DDAT.
The following describes the era table data.
Offset | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dec | Hex |
| Field Name |
| Data Type and Length | ||||||||
0 | 0 |
| Number of table elements |
| UBin(2) | ||||||||
2 | 2 |
| Era element |
| [*] Char(48) | ||||||||
2 | 2 |
| Origin date |
| UBin(4) | ||||||||
6 | 6 |
| Era name |
| Char(32) | ||||||||
38 | 26 |
| Reserved (binary 0) |
| Char(12) | ||||||||
* | * |
| --- End --- |
|
|
The era table is a list of elements that state what era should be used across the time line. The start of usage of a particular era is specified by the origin date. The end of usage of a particular era is terminated by the next table element. The last table element era is used until the end of the time line. The origin date is specified in the internal format. The era name is a character field. The maximum number of table entries allowed is 256.
The SAA era table has one entry. The SAA origin date is January 1, 0001, Gregorian for the start of the time line. The internal format would be 1721426. The SAA name is AD, anno Domini.
The SAA era table can have only one element and that element must have an effective date that falls in the time line specified in the SAA calendar table.
The following describes the calendar table data.
Offset | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Dec | Hex |
| Field Name |
| Data Type and Length | ||||||||
0 | 0 |
| Number of table elements |
| UBin(2) | ||||||||
2 | 2 |
| Calendar change element |
| [*] Char(16) | ||||||||
2 | 2 |
| Effective date |
| UBin(4) | ||||||||
6 | 6 |
| Calendar type |
| UBin(2) | ||||||||
8 | 8 |
| Reserved (binary 0) |
| Char(10) | ||||||||
* | * |
| --- End --- |
|
|
The calendar table is a list of elements that state what calendar type/algorithm should be used across the time line. The start of usage of a particular calendar is specified by the effective date. The effective date is specified using the internal format. This first table element represents the beginning of the time line. The end of usage of a particular calendar is terminated by the next table element. The last table element calendar must be null to indicate the end of the time line. The maximum number of table entries allowed is 256.
The SAA calendar table has 2 entries. The first entry has a calendar type of Gregorian. The effective date is January 1, 0001, Gregorian for the start of the time line. The internal format would be 1721426. The second entry has a calendar type of null. The effective date is January 1, 10000, Gregorian for the end of the time line. The internal format would be 5373485.
Multiple calendar table entries are only valid with DDATs specifying the internal date format code. The rest of format codes can only have two entries in the calendar table. The second entry must have a NULL calendar type.
The following describes the encoding of the calendar types.
Calendar type | Calendar type value |
---|---|
Null | Hex 0000 |
Gregorian | Hex 0001 |
Julian | Hex 0002 |