Just one more thing. Here's he same code, but written in a different way.
//INTERLVE EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
INPUT-RECORD,*,8,CH
COLUMN-AFTER-INPUT-RECORD,*,1,CH
BLANK-INSERTED-FOR-VIEWING-ONLY,=,1,CH
MERGE-SEQNO-IN-EXTENSION,*,7,CH
//SYMNOUT DD SYSOUT=*
//SORTIN01 DD *
RECORD1
RECORD2
RECORD3
//SORTIN02 DD *
RECORD4
RECORD5
RECORD6
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC OVERLAY=(COLUMN-AFTER-INPUT-RECORD:X,SEQNUM,7,ZD)
MERGE FIELDS=(MERGE-SEQNO-IN-EXTENSION,A),NOEQUALS
OUTREC BUILD=(INPUT-RECORD)
//*
If you look at the sort cards, you'll see that they now have "named" fields. These are DFSORT Symbols, defined under the SYMNAMES DD statement.
The position, length and type of the named symbols are converted by DFSORT to the traditional method of specification, which is listed along with the rest of the output, like this:
INREC OVERLAY=(9:X,SEQNUM,7,ZD)
MERGE FIELDS=(10,7,CH,A),NOEQUALS
OUTREC BUILD=(1,8)
The * in the defintions means use the next available byte position (so for the first definition, that will be 1). The = means use the start position of the previously defined field. Fields can also be defined at an explicit starting position, This-Field,20,4,CH
The translation of your symbols from the above appears as output on the SYMNOUT dd statement:
------- ORIGINAL STATEMENTS FROM SYMNAMES -------
INPUT-RECORD,*,8,CH
COLUMN-AFTER-INPUT-RECORD,*,1,CH
BLANK-INSERTED-FOR-VIEWING-ONLY,=,1,CH
MERGE-SEQNO-IN-EXTENSION,*,7,CH
------------------ SYMBOL TABLE -----------------
INPUT-RECORD,1,8,CH
COLUMN-AFTER-INPUT-RECORD,9,1,CH
BLANK-INSERTED-FOR-VIEWING-ONLY,9,1,CH
MERGE-SEQNO-IN-EXTENSION,10,7,CH
If you are new to sorting, you might want to consider using the symbols. They are well-documented, with examples, in the manuals. There is a program written in rexx which is available from IBM's DFSORT team which will generate symbols from a Cobol copybook, so that you can use the same names as in a Cobol program.
Symbols help to document; make it more difficult to get the wrong definition of a field; make the code more maintainable (there might be several references to one field, which in the traditional way would have to be changed, correctly, in each place - with symbols, you just change the definition); allow for easy extension of records without having to constantly count how many bytes are in the original record; etc, etc.