Cast data format specifications—Data extract expressions
A data format specification can be applied to:
- Any of the decimal data types (packed, unsigned, or zoned)
- The character data type (assuming that the value consists solely of decimal digits)
- The fixed binary data type
The data format specification is coded as a percent sign (%) followed immediately by the format specification. There are no intervening spaces.
The data format is coded following the character identifying the basic data type in a cast. If the data type is not specified (for example, allowed to default to either character or the data type defined for a field from the DBDGEN), it can be coded following the length specification of the cast. If a cast is not coded for a field, the data format specification can be coded immediately following the field name. In any case, spaces can be coded as desired to improve readability.
The length of the field or portion of a segment identified by a cast must agree exactly with the number of decimal digits indicated by the data format specification.
Date formats
Date formats are used to tell the expression processor the structure of a date value. The following date format specifications are currently defined:
- yyyymmdd
- yymmdd
- ddmmyyyy
- ddmmyy
- mmddyyyy
- mmddyy
- yyyyddd
- yyddd
The variables have the following meanings:
- dd (two digit day of the month)
- ddd (three digit Julian day of the year)
- mm (designates a two digit month)
- yy (designates a two digit year)
- yyyy (designates a four digit year)
Time formats
Time formats are used to tell the expression processor the structure of a time value. The following time format specifications are currently defined:
- hhmmss
- hhmm
- hhmmssf
- hhmmssff
The variables have the following meanings:
- f (one digit 10th of a second)
- ff (two digit 100th of a second)
- hh (two digit hour)
- mm (two digit minute)
- ss (two digit second)