Previous Topic: SELECT Statement

Next Topic: The Historical Database


SORT Statement

Position

Field Length

Field Name

Notes

1

1

Set Code

Required

2-9

8

Statement Type

SORT

10-17
18-25
26-33
34-41
42-49

8
8
8
8
8

1st Sort Level
2nd Sort Level
3rd Sort Level
4th Sort Level
5th Sort Level

pppllosd must be blank or numeric where:

ppp: Position of sort field from

VM Basic Accounting Table

ll: Length of sort field

(maximum is 8)

o: Order of sort field

A = ascending (default)

D = descending

s: Summary Line Print Option:

see table below

d: Description Header Flag:

= suppress printing

1 = print Description Header

for this level

50

1

Job Flag

1 required for VM processing

51-54

4

 

Required blanks

55-62

8

History File DDname

= No History File
xxxxxxxx = History File DDname

63

1

History Level Flag

1-5 = Summary level history file with charges applied

64

1

Print DDname Suffix

If nonblank, append to DDname of CAIJSPRT and use that DDname for the report output

65-80

16

Reserved

Not used

Summary Line Print Option Table

or N - No summary print for this level
1, 2, or 3 - Single, double, or triple space before printing summary
E* - Eject to new page after printing summary
P* - Eject to new page and reset page number after printing summary

* If either E or P is specified for the first level summary line, then grand totals print on a page by themselves.

The SORT statement, identified by the statement Type SORT, is required. It allows the input accounting data to be sorted on up to five different fields. Each field or sort level is defined by the format pppllosd where:

ppp

is a three-digit number indicating the sort field's starting position. Refer to the VM Basic Accounting Table later in this chapter.

ll

is a two-digit number between 01 and 08 defining the length of the sort field in the VM Basic Accounting Table.

o

indicates the sort order:

A =

ascending (default)

D =

descending

s

is the summary print option that tells the Report Writer whether the user wants a summary line printed for this level and is defined as follows:

N or =

no summary line is printed at this level.

1, 2, or 3 =

single, double, or triple spacing before printing the summary line.

E =

eject to a new page after printing summary.

P =

eject to new page and reset page number to 1 after printing. (If either E or P is specified for the first [major] summary level, grand totals print on a page by themselves.)

d

indicates whether a Descriptive Header appears at this level.

The creation of any user sort control field may be omitted. If no sort control field is specified, the accounting data is arranged in the following default order:

The maximum length of each user-defined sort control field is eight (8) characters. Sort field definitions of less than eight characters are padded with trailing blanks. In addition to a summary line at each of the five levels, the Report Writer automatically produces a final totals line at the conclusion of a report.

Each SORT statement must have a set code.

The following example illustrates a typical SORT statement:

            Firt Sort Level        Second Sort Level

1            10                     18

ASORT        30108AE1               01608A21

Report A is sorted on two levels. The more general level is project ID (begins at position 301 in the Basic Accounting Table), an 8-character field, sorted in ascending order. The E1 tells CA JARS to eject to a new page after printing summary lines, and include descriptive headers.

The second sort level is userid (position 16 in the Basic Accounting Table), an 8-character field sorted in ascending order. The 21 tells CA JARS to skip two lines before printing summary lines, and include descriptive headers.

The Print DDname Suffix can be used to tell the Report Writer to use different print file DD statements for each report. When this position is non-blank, the character is appended to CAIJSPRT and used as the DDname for the print file for this report. For example, CAIJSPRT is the DDname when the suffix character is a 1. When running under CMS, you identify a DDname with a FILEDEF command. For instance, you would modify the CAIJV050 EXEC to include the command:

FILEDEF CAIJSPRT DISK REPORT1 OUTPUT A1