Changing the sequence of displayed or printed rows

To change the order in which rows are displayed or printed, use the Order field and, optionally, the A/D field on the Column Selection/Edit panel. For the most significant column, type “1” in the Order field; for the next most significant column, type “2” in the Order field, and so on. If you use the Order field, rows are displayed in ascending sequence by default. To display the rows in descending sequence, type “D” in the A/D field.

If you use either the Order or A/D fields on the Column Selection/Edit panel, FM/Db2 adds an ORDER BY clause to the SQL SELECT statement used to retrieve the data from Db2®.

For example, on the Column Selection/Edit panel shown in Primary Column Selection/Edit panel showing row sequence selection, the Order and A/D fields specify rows to be shown in the sequence LASTNAME (ascending) within WORKDEPT (descending).
Figure 1. Primary Column Selection/Edit panel showing row sequence selection
   Process   Options   Utilities   Help
 ────────────────────────────────────────────────────────────────────────────────
 FM/Db2 (DFG2)               Column Selection/Edit                 Line 1 of 16
 TABLE FMNUSER.EMP
 ------- Row Selection Criteria ---- (Use SQL/PF4 for full screen edit) -------
 1 Sel:                                                                       +

 Cmd Seq SHEX CL# Column name          Data type(length)  Null Default  Order A/D
                  ****  Top of data  ****
         S      1 EMPNO                CHARACTER(6)            None             
         S      2 FIRSTNME             VARCHAR(12)             None             
         S      3 MIDINIT              CHARACTER(1)            None             
         S      4 LASTNAME             VARCHAR(15)             None        2   A
         S      5 WORKDEPT             CHARACTER(3)        Y   Null        1   D
         S      6 PHONENO              CHARACTER(4)        Y   Null             
         S      7 HIREDATE             DATE                Y   Null             
         S      8 JOB                  CHARACTER(8)        Y   Null             
         S      9 EDLEVEL              SMALLINT            Y   Null             
         S     10 SEX                  CHARACTER(1)        Y   Null             
         S     11 BIRTHDATE            DATE                Y   Null             
         S     12 SALARY               DECIMAL(9,2)        Y   Null             
  Command ===> _____________________________________________________ Scroll PAGE
   F1=Help      F2=Split     F3=Exit      F4=SQL       F5=RFind     F6=RunTemp
   F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel
When the data is displayed, it appears in the revised sequence:
Figure 2. Table Browse panel
  Process   Options   Utilities   Help
────────────────────────────────────────────────────────────────────────────────
 FM/Db2 (DFG2)                    Table Browse                        42 rows fetched
 TABLE FMNUSER.EMP                                                  Format TABL
 EMPNO  FIRSTNME     MIDINIT LASTNAME        WORKDEPT PHONENO HIREDATE   JOB
 #1     #2           #3      #4              #5       #6      #7         #8   +
 CH(6)  VARCHAR(12)  CH(1)   VARCHAR(15)     CH(3)    CH(4)   DATE       CH(8)
 PU--+> <---+----1-> -       <---+----1----> <-NF     <-->    <---+----> <---+-
 ****  Top of data  ****
 200340 ROY<         R       ALONZO<         E21      5698    05/05/1947 FIELDR
 000340 JASON<       R       GOUNOT<         E21      5698    05/05/1947 FIELDR
 000330 WING<                LEE<            E21      2103    02/23/1976 FIELDR
 000320 RAMLAL<      V       MEHTA<          E21      9990    07/07/1965 FIELDR
 000100 THEODORE<    Q       SPENSER<        E21      0972    06/19/1980 MANAGE
 200330 HELENA<              WONG<           E21      2103    02/23/1976 FIELDR
 000090 EILEEN<      W       HENDERSON<      E11      5498    08/15/1970 MANAGE
 000290 JOHN<        R       PARKER<         E11      4502    05/30/1980 OPERAT
 000280 ETHEL<       R       SCHNEIDER<      E11      8997    03/24/1967 OPERAT
 200280 EILEEN<      R       SCHWARTZ<       E11      8997    03/24/1967 OPERAT
 000310 MAUDE<       F       SETRIGHT<       E11      3332    09/12/1964 OPERAT
 000300 PHILIP<      X       SMITH<          E11      2095    06/19/1972 OPERAT
 Command ===> _____________________________________________________ Scroll PAGE
  F1=Help      F2=Zoom      F3=Exit      F4=CRetriev  F5=RFind     F6=RChange
  F7=Up        F8=Down      F9=Swap     F10=Left     F11=Right    F12=Cancel

Related references