I have an input dataset that looks like the following. Note the columns for the data are 2, 11, and, 56. I use the sort control cards to remove the unwanted records and generate ALTER statements for IDCAMS to change the GDG bases with Noscratch to Scratch. This works well, but it does lead me to one question that I wonder how other solve or if DFSORT has addressed the issue and I just don't know about it.

Is there a way to "extract" a variable length field, like a dataset name, and build an output record with that extracted field and its variable length used rather than a fixed length? The problem is to have other fields follow the variable length field without having to use a second pass to remove the extra spaces when a fixed length field is used. If this is possible it does raise a second question as to how to do this and output a fixed length record as you would have to be able to calculate the size of the final "padding" blank field. Maybe that problem could be overcome by first building the correct record length as all blanks and then using the overlay parameter to build the "real" record.

Currently all I know how to do is build the varying length field into a fixed length field that is the maximum size for the field and then in a second past squeeze out the extra spaces between it and the following fields.

In my case here I was able to use the TRAIL parameter to solve the problem, but in other cases the trailing data may be several fields from the original input record and the TRAIL parameter would not work.

 CATALOG  UCAT.PROD.TSO9
 GDG      C800520.TEST.SAX012.EXTRACT  2007.145 010 Noempty Scratch
 GDG      C800520.TEST.WKCL.RPT        2009.114 120 Noempty Scratch
 GDG      C801173.TEST.GDG.SAMPLE      2010.083 010 Noempty Scratch
 GDG      C803250.TEST.BKPY.SYSOUT     2012.018 255 Noempty Noscratch
 GDG      C803250.TEST.TEMP.BAKUP      2007.155 013 Noempty Scratch

  OMIT COND=(2,7,CH,EQ,C'CATALOG',OR,77,7,CH,EQ,C'Scratch')
  SORT FIELDS=COPY
  OUTREC BUILD=(C' ALTER ',11,44,JFY=(SHIFT=LEFT,LEAD=C'''',
  TRAIL=C''' SCRATCH',LENGTH=73))

 ALTER 'C803250.TEST.BKPY.SYSOUT' SCRATCH


Ken Leidner                     [email protected]

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to