Reformatting with fixed fields
Reformatting with fixed fields
Reformat records can be achieved in files by using the INREC, OUTREC, and OUTFIL control statements. These control statements can be coded separately or together.
- The INREC statement reformats records before they are sorted, copied, or merged.
- The OUTREC statement reformats records after they are sorted, copied, or merged.
- The OUTFIL statement can reformat records after they are sorted, copied, or merged. Different reformatting parameters can be used for different OUTFIL files.
INREC, OUTREC and OUTFIL uses the below parameters to achieved the reformatting -
- BUILD - builds the reformatted records in the order how they coded one by one.
Users can delete, rearrange, and insert fields and constants by using BUILD. - OVERLAY - Reformats the records by coding the fields that overlay specific columns.
- FINDREP - Reformats the record by doing various types of finds and replace operations.
- IFTHEN clauses - Reformats different records in different ways. Reformat records by coding how to build, overlay, find/replace, or group operation items.
- Reformatting records after sorting with BUILD or FIELDS - The fields which are not needed can be ignored by using the FIELDS or BUILD parameter of the OUTREC statement.
Below list of tasks is performed when INREC, OUTREC, and OUTFIL are used in sorting, copying, or merging -
- Delete fields.
- Reorder fields.
- Insert separators like blanks, zeros, strings, current date, future date, past date, and current time.
- Translate data from uppercase to lowercase, lowercase to uppercase, EBCDIC to ASCII, and ASCII to EBCDIC.
- Translate data to hexadecimal and bit representation.
- Convert date fields from one data type to another data type.
- Convert numeric values to different types that are printable with or without separators, decimal points, leading or suppressed zeros, and signs.
- Convert numeric values from one format to another format.
- Perform arithmetic operations using numeric values and decimal constants.
- Perform arithmetic operations on date fields.
- Change values using a lookup table.
- Replace or remove data using find and replace operations.
- Insert sequence numbers.
- Left-justify data, right-justify data, left-squeeze data, and right-squeeze data.
- Perform various operations on groups of records.