z/OS DFSORT Application Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Example 22

z/OS DFSORT Application Programming Guide
SC23-6878-00

  OPTION COPY
  OUTFIL BUILD=(1,80,SQZ=(SHIFT=LEFT,PAIR=APOST,MID=C','))

This example illustrates how you can create FB output records with comma separated values from FB input records containing fields in fixed positions.

The 80-byte FB input records might look like this:
  'John Lewis'         -12.83  'Research'
  'Ted Blank'         +128.37  'Manufacturing'
  'Marilyn Carlson'   -282.83  'Technical Support'
  'Rex Otis'            +2.83  'Marketing'

Note that the data has three fields in fixed positions. The first field is a character string surrounded by apostrophes. The second field is a numeric value. The third field is another character string surrounded by apostrophes.

The 80-byte FB output records are in the form of comma separated values as follows:
'John Lewis',-12.83,'Research'
'Ted Blank',+128.37,'Manufacturing'
'Marilyn Carlson',-282.83,'Technical Support'
'Rex Otis',+2.83,'Marketing'

We use OUTFIL BUILD to build the output records with comma separated values. We use SQZ to squeeze out the blanks between the fields, shift the remaining characters to the left and insert commas between the fields. SHIFT=LEFT shifts the characters to the left. PAIR=APOST ensures that blanks within paired apostrophes are not squeezed out (for example, we want to keep the blank in the 'John Lewis' field.) MID=C',' inserts a comma for each group of blanks removed between the fields (for example, between 'John Lewis' and -12.83).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014