The general structure of the query is
verb table filter order display
SORT CUSTOMER IF HATSIZE = "7" BY SHOESIZE NAME CITY STATE ZIP
Where
verb = SORT
table = CUSTOMER
filter = IF HATSIZE = "7" (you can have multiple filters
order = BY SHOESIZE (you can have multiple order elements)
display = ID NAME CITY STATE ZIP (ID isn't on the list, but it is implied)
For this to work, the TABLE (also called a FILE) named CUSTOMER has to exist.
CUSTOMER must have a dictionary (schema/view repository) which defines HATSIZE SHOESIZE NAME CITY STATE and ZIP.
A more coherent example:
SORT CUSTOMER IF ORDER.LIMIT > "12,000.00" AND WITHOUT STATUS "INACTIVE" BY-DSND ORDER.LIMIT BY ZIP ORDER.LIMIT ZIP NAME STATUS
Which would select CUSTOMERs with $12K or more ORDER.LIMIT who are not INACTIVE and sort them form biggest limit to least... you get the idea.