Using field references and literals
Field references and literals can be specified in the Target window Data fields of the Reformat Definition Editor screen. Field references are markers that indicate which fields File-AID is to copy from the source record and where it is to put them in the target record. Literals initialize a field.
You can create a field reference by specifying:
- A slash (/) followed by the name or number of the field you want to copy from the source record layout
- A literal to initialize the field.
The following are guidelines for using field references:
- A record must meet all the selection criteria in the Source window to be reformatted for the target data set.
- You can copy Source field data to the same field in the target record or to a different field.
You can copy data from one field to another of the same type. For example, you can copy a character field to a group item. You can copy numeric items to another numeric field. See the following table for information on copying various types of data.
To copy data to unsupported data types, you can use a field overlay. See Using Field Overlays.
- The referenced name can be the exact name or a substring. You need to specify only enough of the name to make it unique. File-AID searches for an exact match before looking for a substring. The search is terminated if an exact match is found.
- You can copy data from a COBOL record layout to a PL/I record layout or vice versa.
- If the fields are different lengths, the target field determines the length. The following table provides information on copying fields with different lengths based on data type.
Reformat Field Referencing by Data Type and Field Length
Types of Data | Referencing Limitations | If Target Field is Longer than Source Field | If Target Field is Shorter than Source Field |
---|---|---|---|
Character, character justified right, character varying, and group | Referencing among these types only. | Data is padded with spaces on the right for left justified and the left for right justified. | Data is truncated on the right for left justified and the left for right justified. |
Bit and bit varying | Referencing among these types only. | Data is padded with binary zeroes on the right. | Data is truncated on the right. |
Unsupported data types | Referencing among these types only. | Source and target fields must have the same length. | Source and target fields must have the same length. |
Numeric zoned (display) or numeric packed fields | Referencing among these types only. If the source field is signed but the target field is unsigned, the data is stripped of its sign. If the source field is unsigned but the target field is signed, the data is set to a positive sign. If the field pictures are not the same, the fields are aligned to decimal points. | Zeroes are added on the right or left as needed. | Data is truncated on the right or left. |
Numeric binary, pointer, index, or offset fields | Referencing among these types only. If the source field is signed but the target field is unsigned, the data is stripped of its sign. If the source field is unsigned but the target field is signed, the data is set to a positive sign. The length and picture of the fields must match. | No truncation or padding; length and picture of the fields must match. | No truncation or padding; length and picture of the fields must match. |
Field Reference Example
To copy field 2 from the source record to field 4 in the target record, type a slash (/) in the target Data field followed by the field name. In the Source window below, three fields are displayed:
In the Target window below, /ASM05-NAME is the field reference that will copy field 2 from the source record to field 4 in the target record:
The field reference could also be made by field number instead of field name. In this case, the Target window is specified as: