Replacing low values to spaces in Sort

How can I replace all the low-values in a file to spaces?

We can use ALTSEQ CODE to change the low-values or high-values to spaces in a file using Sort.
Here’s an example of how you could change all low values (X’00’) to spaces (X’40’), in an FB data set with an LRECL of 80:

ALTSEQ CODE=(0040)
OUTREC FIELDS=(1,80,TRAN=ALTSEQ)

Change uppercase to lowercase or lowercase to uppercase in Sort

Translation features of INREC, OUTREC and OUTFIL make it easy to change the case of characters in your fields.

The TRAN=LTOU operand can be used to change lowercase EBCDIC letters (a-z) to uppercase EBCDIC letters (A-Z) anywhere in a field.

The TRAN=UTOL operand can be used to change uppercase EBCDIC letters to lowercase EBCDIC letters anywhere in a field.

You could change the case in the entire record as well or part of the record.

For example, here’s how you could change uppercase to lowercase in the records of an FB data set with an LRECL of 200:

OUTREC BUILD=(1,200,TRAN=UTOL)

And here’s how you could change uppercase to lowercase in the records of a VB data set with any LRECL:

OUTREC BUILD=(1,4,5,TRAN=UTOL)

Here’s how you could change lowercase letters to uppercase letters in a 100-byte character field starting at position 51 in an FB data set with an LRECL of 300:

OUTREC BUILD=(1,50,                      1-50: no change 
              51,100,TRAN=LTOU,          51-150: L to U                                    
              151,150)                   151-300: no change

Add leading and trailing Characters in Sort

Lets assume that we have a sequential dataset with records as below:

ONE
TWO
THREE
FOUR
FIVE

I want to reformat the records for output as follows:

NUMBER ‘ONE’
NUMBER ‘TWO’
NUMBER ‘THREE’
NUMBER ‘FOUR’
NUMBER ‘FIVE’

You can do this quite easily with DFSORT’s JFY function as follows:

OPTION COPY
INREC BUILD=(1,13,JFY=(SHIFT=LEFT,LEAD=C’NUMBER ”’, TRAIL=C””))

SHIFT=LEFT left-justifies the data. LEAD inserts the hard coded text NUMBER ‘ before the value with no intervening blanks.

TRAIL inserts ‘ after the value with no intervening blanks.