Space announcement

   

The Using section of the MainView for DB2 documentation is now available in Japanese. The displayed language is dependent on your browser language. You can switch languages from the Language menu.

SORT and SORT2 parameters

The SORT and SORT2 parameters specify primary and secondary sort keys for ordering specific formula fields.

The SORT parameter overrides the primary sort key that is already defined in the report. The SORT2 parameter overrides the secondary sort key that is already defined in the report.

The following figure shows the syntax of the SORT parameter.


figure shows the syntax of the SORT2 parameter.


The following table displays the values for the SORT and SORT2 parameters.

Keyword

Description

Value

Description of value

SORT

SORT2

Indicates the rearranged sort order for the report

The sort keys can be a qualifier type or a specific formula occurring in the report. One of these values is required.

If you specify SORT without SORT2, the primary sort key is taken from the SORT specification, and the secondary sort key is taken from the report definition. If you specify SORT2 without SORT, the primary sort key is taken from the report definition and the secondary sort key is taken from the SORT2 specification.

Valid abbreviation (SORT): S

Valid abbreviation (SORT2): S2

type

Qualifier type to be used as the primary or secondary sort key for ordering the report

The following qualifier types are valid:

  • PLAN (plan name) Valid abbreviation: P

  • OPERATOR (original operator ID)Valid abbreviations: OPER, OPID, O

  • DB2 (DB2 subsystem ID)Valid abbreviation: U

  • AUTHID (authorization ID) Valid Abbreviations: AUTH, A

  • CORRELATION (correlation ID) Valid Abbreviations: CORR, C

  • LLOCATION (local location) Valid Abbreviations: LLOC, KL

  • RLOCATION (requesting location) Valid Abbreviations: RLOC, KR

  • COLLECTION (collection ID) Valid abbreviations: COLL, W

Fnnnn

Specifies the name of the formula, the value of which is to be used as the primary or secondary sort key for ordering the report

The following table shows the valid formulas that can be used with SORT and SORT2.

A

Specifies that the values for the primary or secondary sort key will be reported in ascending order

A is the default.

NA

NA

D

Specifies that the values for the primary or secondary sort key will be reported in descending order

NA

NA

The following table lists the appropriate fields and the corresponding formulas.

Field

Formula (Fnnnn)

BACCTSR

BACCTLT

Buffer update

F4620

M4620

Close

F3090

M3090

CPU (CL1)

F2110

F2140

CPU (CL2)

F2210

F74

Delete

F3030

M3030

Elapsed (CL1)

F2100

F2100

Elapsed (CL2)

F2200

F2204

Fetch

F3080

M3080

Getpage

F4610

F4610

Insert

F3010

M3010

Lock suspension

F3800

M3800

Lockout

F3710

M3710

Open

F3070

M3070

Dynamic Prefetch

F4670

M4670

Prepare

F3060

M3060

Select

F3000

M3000

Synch read

F4650

M4650

Update

F3020

M3020


Examples

In the following example using SORT and SORT2, this statement produces an BACCTSR. The data is sorted by authorization ID (type) in ascending order by default and, within authorization ID, sorted again by application elapsed time (formula) in descending order.

REPORT(NAME(BACCTSR)  - 
      SORT(AUTH)       - 
      SORT2(F2100,D))

In the following example, which uses SORT and SORT2 along with OUTLIM, the statement produces BACCTSR. The report is sorted by DB2 elapsed time in descending order. Only the ten plans with the highest DB2 elapsed time are reported.

REPORT(NAME(BACCTSR)  - 
      SORT(F2110,D)    - 
      OUTLIM(10)




Related topic


This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments.

Comments