Is there a way to set/change the SORT AREA in a Natural program?
Example:
READ IN-FILE . . . [ [ Do some input file stuff if needed ] ]
END-ALL
SORT {IN-FILE field sort parameters} USING {other IN-FILE fields}
[ [ Do some processing stuff ] ]
END-SORT
END
What do you mean by “sort area”? I presume you mean the data to be sorted.
The logical “records” to be sorted are a combination of the sort keys and the field list from the USING clause; what you defined as
and
So you have complete control over the sort area.
Pete, you specified in your SORT statement:
SORT {IN-FILE field sort parameters} USING {other IN-FILE fields}
IN-FILE fields. In point of fact, you can have any fields as sort parameters or in the USING clause.
In addition, you do not have to have a READ (or FIND) statement to “anchor” the sort logic. You can have any loop; HISTOGRAM, FOR, REPEAT, READ WORK FILE. You do not have to sort “records”, you can sort arrays of data.
So, as Ralph indicated, you have complete control over what gets written to the “spin off” file to be sorted.
steve
if you are looking for control over the SORT program’s options, the DD $ORTPARM allows you to specify additional SORT parameters - I’ve used it to specify NORLSOUT and/or RELEASE=OFF when a Natural program (or step) will call the SORT many times and is likely to use temporary sort work files.
I believe this DD applies to SYNCSORT and ICEMAN (IBM’s SORT), but check your owner’s manual!