The RETYPE command overrides the data format of a source or target field as specified in the description associated with the field. This command is useful for ‘redefining’ fields/columns that contain data in a format that may not be consistent with the definition, such as binary data in a character field.
Syntax
RETYPE <source_field> <datatype>;
Keyword and Parameter Descriptions
Keyword | Description |
---|---|
<source_field> |
Specifies the name of the source or target data field/column that is to be retyped. |
<datatype> | The redefined data type/format of the field/column. The valid values for <datatype> are:
|
Example 1: Group Field Retyping
Retype the 01 group level field, RECORD-START, of source data structure INPUT-RECORD to a binary data stream.
RETYPE INPUT-RECORD.RECORD-START DTBINARY;
Example 2: Source/Target Field Retyping
Retype the source field SRC-FIELD1, which contains a packed date in a character field, to DTPACKED. Retype the target field TGT_COLUMN1, which is a binary number in a character field, to DTBINARY.
RETYPE SRC-FIELD1 DTPACKED;
RETYPE TGT_COLUMN1 DTBINARY;