如何使用SORT将空白行移到文件末尾? [英] How to use SORT to move blank lines to the end of the file?
问题描述
我有9787条记录,其中前17行为空白.我想将这17行移动到文件末尾. 我该怎么办?
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?
推荐答案
下面将使用SORTOUT DD末尾的空行对输入数据集进行排序
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 *
排序字段=(1,80,CH,D)
//*
//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)表示它是使用字符数据从位置1降序排列的80个字符.
如果数据集的宽度超过80个字符,则可能需要在此处输入实际宽度,否则可能不会在末尾插入空白行.
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.
这篇关于如何使用SORT将空白行移到文件末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!