![]() |
Selection mask - - VARIABLE ACTION field - - SORT
ONXSORT ['str1'=...] [SF=fld] [, OUT=file] [, ?]
ONXSORT ['str1'=...] [?] [%name] [, OUT=file]
This Variable Action will call the BS2000 SORT program. The marked files / library elements can be sorted singly or merged to one output file.
'str1'='str2' Name transformation rules. The files / library elements marked with X will be sorted singly. The name of the file to be created by the sort program is constructed such that a search is made in the input file name for 'str1', and if found, will be replaced by 'str2'. By definition, every name is suffixed with a blank string '_', and prefixed with an empty string '' . If the input file name does not contain 'str1', it will not be sorted.
If 'str1'='str2' is not specified, then, depending on the OUT= parameter, the file will be sorted to itself (OUT=*SAME), or to a single output file (OUT=file).
SF= Sort Fields.
(field-1) [, (field-2)] .... or
((field-1) ,(field-2) .... ,(field-n)) [,FORMAT=format] [,SIZE=n] [,OPT=...] ...
Specification of the sort fields, their format, and any additional options according to the syntax of the SORT statement in the SORT program. For a full description, see the SORT (BS2000) Reference Manual. Typical statements are:
(5,10),(20,2,D)
((5,10,A),(20,2,D)),FORMAT=BI,OPT=SEL
When specifying the sort fields, the first parameter (the position of the sort field in the record) must always be given as for a file with RECFORM=V, independent of the actual RECFORM type. Therefore, the first position of a record in a RECFORM F file must be 5.
OUT= file Name of the sorted output file. If multiple input files were marked, file will contain the sorted result of all of the input files. If file does not exist, it will be created with FCBTYPE=SAM, RECFORM=V, BLKSIZE=(STD,16) attributes.
lib(element) Name of the output library and element into which the sorted output should be stored.
*SAME Individual file/library element sort. The original file will be overwritten with the sort result. 'str1'='str2' may not be specified.
lib([t/]*SAME) Individual file/library element sort. The sorted data objects will be saved under the same name as an element of type t in the specified PLAM library. Standard type for t: D
The name of the output file can also be assigned when starting CFS as follows: /FILE file,LINK=SORTOUT,FCBTYPE=..
If the name transformation rule 'str1'='str2' is specified, the OUT= parameter is ignored.
If the OUT= parameter is specified, and if the SF= parameter is omitted, CFS will not display the sort mask. The SORT statements in this case will be requested by SORT itself with RDATA. All statements, as described in the SORT manual, may be entered. An END statement should be entered as the last statement.
? The sort mask will be displayed. A number of options, parameters and exits for controlling the sort process can be entered.
%name The name of a parameter set to which all the parameters entered earlier in a sort mask were saved. The sort parameters will be saved by means of a SP %name command entered from the command field (see below).
?,%name As above. The parameters saved to the %name parameter set will be displayed on screen, and may be modified.
Notes:
Pamkeys and address lists cannot be sorted with this Variable Action.
With input files having Recform=V, care must be taken that the sort fields are within the record boundaries of all input files.
Records from Recform-F input files will be converted to Recform-V format before being passed to the SORT program.
If the OUT= parameter is specified, and if the SF= parameter is omitted, CFS will not display the sort mask. In this case, the SORT statements will be requested from the SORT program itself with RDATA. All statements may be entered, as described in the SORT manual. An END statement should be entered as the last statement.
Description of the input fields of the Sort Parameter mask:
COMMAND : HC [file] set Hardcopy mode
NHC reset Hardcopy mode
/cmd any BS2000 command
SP %name the values entered in the mask will be saved as a parameter set with the specified name.
LP %name the parameter set saved previously with an SP command will be restored to the current mask. This command is equivalent to the Variable Action ONXSORT ?,%name.
? invoke the help system.
F3 capture the current mask to the CFS hardcopy file.
K1 abort the ONXSORT Variable Action.
Shift ENTER invoke the command memory.
Sort-Fields : Identical format to the keyword parameter SF=
Output-File : Identical format to the keyword parameter OUT=
Fcbtype, Blksize, Recsize, Keypos, Keylen, Blkctrl : Characteristics of the sorted output file.
Recsize = 0 implies Recform=V.
Recsize > 0 implies Recform=F.
When sorting single files (ONXSORT'str1'='str2'), the sorted files will have the same characteristics as the input files, if the predefined standard values for Fcbtype, Blksize, Recsize, Keypos, Keylen, Blkctrl are not modified.
Fill-Character : If a value > 0 is specified for Recsize, then output records shorter than this value will be padded with this character to the required length after the sort.
Truncate : Y If a value > 0 is specified for Recsize, output records longer than this will be truncated after the sort.
N If a value > 0 is specified for Recsize, and records appear in the output file with records longer than this value, SORT will be aborted with a DVS error.
SUM-Fields : Definition of SUM fields. The format is identical to that in the Sort-Fields or in the SF= keyword parameter. For further information about sum fields, see the SORT (BS2000) Reference Manual, SUM sort statement.
MODS-Library : Name of the LMR/PLAM library containing required Sort Exits (see below). The name of the MODS library can also be specified before starting CFS with a file command as follows: /FILE file, LINK=SORTMODS.
SORT-Exit E03, ..., EXT : User exits which will call the specified module from the MODS library. Specifying a module name for a sort exit xx corresponds to a sort statement MODS Exx=(LINK=name). For further information, see the SORT (BS2000) Reference Manual, sort statement MODS.
When programming this type of module, care should be taken only to pass Recform-V format records.
Modify extended params : Y A second mask is displayed, in which the parameters for the INCLUDE, OMIT and NEWCOL statements may be entered.
Description of the input fields of the extended sort parameter mask:
COMMAND : HC [file] set Hardcopy mode
NHC reset Hardcopy modue
/cmd any BS2000 command
SP %name the values entered in this and in the main mask will be saved as a parameter set under the specified name.
? invoke the help system.
F3 capture the current mask to the CFS hardcopy file.
K1 abort the ONXSORT Variable Action.
Shift ENTER invoke the command memory.
Include : Definition of the parameters for an INCLUDE statement in the SORT. For further information on the Include statement, see the SORT (BS2000) Reference Manual, INCLUDE sort statement. An example is:
(7,4,BI,EQ,11,4,BI)
(7,4,BI)=C'&&&&'
Omit : Definition of the parameters for an OMIT statement in the SORT. For further information on the Omit statement, see the SORT (BS2000) Reference Manual, OMIT sort statement. An example is:
(7,4,BI,EQ,11,4,BI)
(7,4,BI)=C'&&&&'
Newcol : Definition of the parameters for a NEWCOL statement in the SORT. For further information on the Newcol statement, see the SORT (BS2000) Reference Manual, NEWCOL sort statement. An example is:
(Aa,aÄ,Ää)
(Aa,aÄ,Ää),(00F8,F800)
Examples:
ONXSORT SF=(5,8),(20,3,D),OUT=CFS.SORTFILE
The records of all files marked with X will be sorted and merged to the sequential output file CFS.SORTFILE. Records from Recform=F input files will be converted to V-format before the sort. The primary sort field begins in column 5 (i.e. straight after the 4 byte record length field), is 8 bytes long, and is ascending. The second sort field begins in column 20, is 3 bytes long, and is descending.
ONXSORT' '='.SORT' %SORT1
All the files marked with X will be sorted as single files. The names of the sorted files will be the same as the input files, but suffixed with '.SORT'. The sort parameters, the output file attributes, and all other options for controlling the sort run (sum fields, sort exits, etc.) will be taken from the parameter set %SORT1.