OUTREC Data Translation
OUTREC Data Translation
The OUTREC statement can perform data translation, which involves converting characters from one character set to another. This is commonly used for translating characters like converting uppercase to lowercase, EBCDIC to ASCII, and more.
Syntax -
//SYSIN DD *
OUTREC FIELDS=(starting_pos_of_field1,
field1_length,
TRAN=option,…)
/*
starting_pos_of_field1 | Specifies the starting byte of the numeric field in the record. |
field1_length | Specifies the length of the numeric field. |
TRAN=Option | Specifies the translation type. The available options are -
|
Examples -
Scenario1 - Translating Lowercase to Uppercase.
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,20,TRAN=LTOU)
/*
Translates the first 20 characters of each record from lowercase letters are translated to uppercase.
Scenario2 - Translating Uppercase to Lowercase.
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,20,TRAN=UTOL)
/*
Translates the first 20 characters of each record from uppercase letters are translated to lowercase.