MAPVAL (Map Values) keyword for display files

You use this field-level keyword to map field data to a different value during input and output operations.

This keyword is only valid with the date (L), time (T), or timestamp (Z) data types.

The format of the keyword is:
MAPVAL((program-value-1 system-value-1)
      [(program-value-2 system-value-2) ...
       (program-value-100 system-value-100)])]

You can specify the program value and the system value either as explicit values or as the *BLANK or *CUR special values.

You must specify an explicit value within single quotation marks that matches the format and separator values for the corresponding field. The explicit value must also be a valid date or time. The following list indicates how the formats and separators are determined:
  • If the explicit value is a date (L) value, you must use the format that the DATFMT keyword specifies. If the DATFMT keyword is not specified or if DATFMT specifies *JOB, then you must use the *ISO format. Also, you must use the separator that the DATSEP keyword specifies. If the DATSEP keyword is not specified, or if DATSEP specifies the *JOB separator, a slash (/) must be used for the separator.
  • If the explicit value is a time (T) value, you must use the format that the TIMFMT keyword specifies. If the TIMFMT keyword is not specified, you must use the *ISO format. Also, you must use the separator that the TIMSEP keyword specifies. If the TIMSEP keyword is not specified or if TIMSEP specifies the *JOB separator, you must use a colon (:) for the separator.
  • If the explicit value is a timestamp (Z) value, you must use the yy-mm-dd-hh.mm.ss.mmmmmm format.

The *BLANK special value indicates field data that is composed of all blanks. The *CUR special value indicates that the date, time, or timestamp makes up the current field data, depending on the data type of the field.

During an output operation, the field data is compared to each program-value on the MAPVAL keyword in the order in which the program-values are specified. For the first match that is found, the corresponding system-value replaces the current field data. If a match does not exist, the field data does not change.

During an input operation, the field data is compared to each system-value on the MAPVAL keyword in the order in which the system-values are specified. For the first match that is found, the corresponding program-value replaces the current field data. If a match does not exist, the field data remains the same.

Option indicators are not valid for this keyword, although you can use option indicators to condition the field for which it is specified.

Example

The following example shows how to specify the MAPVAL keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A
00020A          R RECORD
00030A            DATFLD1         L         DATFMT(*MDY) DATSEP('/')
00040A                                      MAPVAL(('01/01/40' *BLANK))
 

On output, if the field data equals '01/01/40', the field data is changed to all blanks. On input, if the field data is blank, the field data is changed to '01/01/40'.