FastSort Manual
Using SORT and SUBSORT DEFINEs
FastSort Manual—429834-003
7-12
Using DEFINEs With Programmatic FastSort
run your application.) After you have set the necessary attributes, you use the
DEFINEADD procedure to name the DEFINE and add it to your application’s PFS.
The following TAL example shows the programmatic use of a SORT DEFINE named
=SORT^DEFINE. The CONVERT^INT^TO^STRING and ERROR^RECOVERY
procedures not shown in this example are user-written procedures.
CONVERT^INT^TO^STRING converts an integer value to a character string for use in
the DEFINESETATTR procedure call. ERROR^RECOVERY processes any errors that
occur in the system procedure calls.
STRING .sort^define^name[0:23],
.attribute^name[0:15],
.attribute^value[0:15];
INT attribute^length,
sortprog^cpu^number,
error;
... ! Enter the SORT DEFINE attribute values from a terminal.
sort^define^name ':=' "=sort^define ";
attribute^name ':=' "CLASS ";
attribute^value ':=' "SORT ";
attribute^length := 4;
error := DEFINESETATTR (attribute^name,
attribute^value,
attribute^length);
IF error <> 0 THEN CALL error^recovery;
attribute^name ':=' "CPU ";
error := convert^int^to^string (sortprog^cpu^number,
attribute^value,
attribute^length);
IF error <> 0 THEN CALL error^recovery;
error := DEFINESETATTR (attribute^name,
attribute^value,
attribute^length);
IF error <> 0 THEN CALL error^recovery;
... ! Set any other SORT DEFINE attributes.
error := DEFINEADD (sort^define^name);
IF error <> 0 THEN CALL error^recovery;
...
Using DEFINEs With Programmatic FastSort
To use a SORT DEFINE other than =_SORT_DEFAULTS in a program, specify the
DEFINE name in the SORTBUILDPARM procedure described in Section 5, Using
FastSort System Procedures. If you omit the DEFINE name parameter in
SORTBUILDPARM, or if you specify a name of all blanks, FastSort does not check for
a SORT DEFINE.