I have 9787 records of which the first 17 lines are blank. I want to move those 17 lines to the end of the file. How can I do that?
The below will sort the input dataset with the blank lines at the end of the SORTOUT DD
//SORT EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTWK01 DD SPACE=(CYL,(10,5),RLSE)
//SORTWK02 DD SPACE=(CYL,(10,5),RLSE)
//SORTWK03 DD SPACE=(CYL,(10,5),RLSE)
//SORTIN DD DSN=INPUT.DATASET,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,80,CH,D)
//*
FIELDS=(1,80,CH,D) means it is sorting in descending order from Position 1 for 80 characters using character data.
If you dataset is wider than 80 characters you might need to put the actual width here or the blank lines might not be put at the end.