Describing a Sort Object: SORTOBJ

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.


Top of page

x
Reference: Usage Notes for Sort Objects in a Master File

Top of page

x
Syntax: How to Declare a Sort Object in a Master File
FILE= ...
SEG= ...
FIELD= ...
SORTOBJ sortname = {BY|ACROSS} sortfield1 [attributes]
  [{BY|ACROSS} sortfield2 ... ]; 
  [,DESC[CRIPTION]='desc',] 
  [DESC_ln='descln', ... ,]$ 

where:

sortname

Is a name for the sort object.

sortfield1, sortfield2 ...

Are fields from the Master File or local DEFINE fields that will be used to sort the report output.

attributes

Are any valid sort attributes.

;

Is required syntax for delimiting the end of the sort object expression.

DESC[CRIPTION]='desc'

Is a description for the sort object in the default language.

DESC_ln='descln'

Is a description for the sort object in the language specified by the language code ln.


Top of page

x
Syntax: How to Reference a Sort Object in a Request
TABLE FILE ...
   .
   .
   .
BY sortname   .
   .
   .
END

where:

sortname

Is the sort object to be inserted into the request.



Example: Declaring and Referencing a Sort Object

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

WebFOCUS