How to: |
Reference: |
You can define sort phrases and attributes in a Master File and reference them by name in a request against the Master File. The entire text of the sort object is substituted at the point in the TABLE where the sort object is referenced. The sort phrases in the sort object are not verified prior to this substitution. The only verification is that there is a sort object name and an equal sign in the Master File SORTOBJ record.
FILE= ... SEG= ... FIELD= ... SORTOBJ sortname = {BY|ACROSS} sortfield1 [attributes] [{BY|ACROSS} sortfield2 ... ]; [,DESC[CRIPTION]='desc',] [DESC_ln='descln', ... ,]$
where:
Is a name for the sort object.
Are fields from the Master File or local DEFINE fields that will be used to sort the report output.
Are any valid sort attributes.
Is required syntax for delimiting the end of the sort object expression.
Is a description for the sort object in the default language.
Is a description for the sort object in the language specified by the language code ln.
TABLE FILE ... . . . BY sortname . . . END
where:
Is the sort object to be inserted into the request.
The following sort object for the GGSALES Master File is named CRSORT. It defines two sort phrases:
SORTOBJ CRSORT = ACROSS CATEGORY BY REGION SKIP-LINE ; ,$
The following request references the CRSORT sort object:
TABLE FILE GGSALES SUM DOLLARS BY CRSORT ON TABLE SET PAGE NOPAGE END
The output is:
Category Region Coffee Food Gifts ------------------------------------------------ Midwest 4178513 4404483 2931349 Northeast 4201057 4445197 2848289 Southeast 4435134 4308731 3037420 West 4493483 4204333 2977092