Question

I have the following input file with a variable length (RECFM=VB) for example :

AAAAABBBBBCCCCCDDDDDEEEEEFFFFF

AAAAABBBBBCCCCCDDDDDEEEEEFFFFF

AAAAABBBBBCCCCCDDDDDEEEEEFFFFF 

I am trying to get the output file as below by skipping the A column. Is there a way that I could do this using DFSORT ? (outrec ?!)

BBBBBCCCCCDDDDDEEEEEFFFFF

BBBBBCCCCCDDDDDEEEEEFFFFF
Was it helpful?

Solution

Of course

  OPTION COPY
  INREC BUILD=(1,4,6)

The 1,4 is the RDW (Record Descriptor Word) and is always necessary in a BUILD for a variable-length record. The "6" says, "from start position 6 to the end of the variable record". DFSORT will adjust the record-length in the RDW accordingly, and your output on SORTOUT should be what you want.

It would the same with OUTREC instead of INREC, but unless OUTREC is needed (after a SORT and with processing dependent on that) I use INREC.

It would also be possible with OUTFIL, but same applies (for me).

EDIT:

For a comparison, here is removing the first five of a fixed-length record. I'll use an LRECL of 80:

  OPTION COPY
  INREC BUILD=(6,75,5X)

The 5X will put five blanks after the 75 bytes of data, if the LRECL is to stay the same, else leave it off.

DFSORT manuals are available online from IBM, including a good "Getting Started". There are many examples in the manuals. For more complex manipulations there is the "Smart DFSORT Tricks" publication from IBM.

EDIT:

From your comment, start reading from here:

http://publib.boulder.ibm.com/infocenter/zos/v1r13/index.jsp?topic=%2Fcom.ibm.zos.r13.iceg200%2Fice1cg6025.htm

And here:

The fields are "fixed" in the discussion, do not confuse this with fixed-length records. Fixed-length fields are where you have a start-position and a length. Variable fields are where you only have the start-position (on a variable-length record) or when defining PARSEd fields.

The document is also available as a PDF, ice1cg60.pdf is the current one, but it is worth locating the one which matches your version/level of DFSORT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top