OK, two answers. First, is with a BUILD, putting the sequence number at the start of the record, as you have shown in your example. 2 is the length, ZD is the type, so can be any sensible length and type for a numeric as described in the manual. The 1,17 takes the rest of the data from the input record and places it after the sequence number.
//SEQNUMB EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(SEQNUM,2,ZD,1,17)
//*
//SORTIN DD *
SOME RECORDS 01 -
SOME RECORDS 02 -
SOME RECORDS 03 -
SOME RECORDS 04 -
SOME RECORDS 05 -
SOME RECORDS 06 -
SOME RECORDS 07 -
SOME RECORDS 07 -
SOME RECORDS 09 -
SOME RECORDS 10 -
Second is with OVERLAY. Same format, but sequence number appears at the end of the record. No movement of the original data.
With a BUILD and at the front, you can do sequence numbers on a variable-length file and still know where they are afterwards without making the records all the same length (negating the "variable" bit of the file description).
With the OVERLAY you can add a sequence number to the back of the record on a fixed-length file, without shifting the data around (so performing better).
//SEQNUMO EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(18:SEQNUM,2,ZD)
//SORTIN DD *
SOME RECORDS 01 -
SOME RECORDS 02 -
SOME RECORDS 03 -
SOME RECORDS 04 -
SOME RECORDS 05 -
SOME RECORDS 06 -
SOME RECORDS 07 -
SOME RECORDS 07 -
SOME RECORDS 09 -
SOME RECORDS 10 -
Output 1:
01SOME RECORDS 01 -
02SOME RECORDS 02 -
03SOME RECORDS 03 -
04SOME RECORDS 04 -
05SOME RECORDS 05 -
06SOME RECORDS 06 -
07SOME RECORDS 07 -
08SOME RECORDS 07 -
09SOME RECORDS 09 -
10SOME RECORDS 10 -
Output 2:
SOME RECORDS 01 -01
SOME RECORDS 02 -02
SOME RECORDS 03 -03
SOME RECORDS 04 -04
SOME RECORDS 05 -05
SOME RECORDS 06 -06
SOME RECORDS 07 -07
SOME RECORDS 07 -08
SOME RECORDS 09 -09
SOME RECORDS 10 -10