Previous Topic

Next Topic

Book Contents

Book Index

Examples

Example 1

This example illustrates a moderately deep and narrow index hierarchy.

Index Level

  01              main

                   |

  02               1

                 /    \

  03            2     5

               /     /  \

  04          3     6    7

              |          |

  05            4            8

To create this hierarchy, the user defines the following DO INDEX/SUBINDX statements. The Index Level Display is generated automatically as each path is completed.

Figure 242 DO INDEX Parameter – Example 1

----- CONTROL-D/V CATEGORY NDX11232            JOB  NDXTST1  ----------- (R.S)

COMMAND ===>                                                   SCROLL===> CRSR

+-------------------------------------------------------------------------------+

===========================================================================

  DO INDEX   = MAIN                 M   R   G   LINE  00001 COL 00073 - 00077

        MASK =                      RC N LINE       -       COL       -     

  02 SUBINDX = INDEX_1              M   LVL 02  LINE  00001 COL 00007 - 00025

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_2              M   LVL 03  LINE  00000 COL 00007 - 00015

        MASK =                      RC Y LINE       -       COL       -     

  04 SUBINDX = INDEX_3              M   LVL 04  LINE  00000 COL 00017 - 00030

        MASK =                      RC Y LINE       -       COL       -     

  05 SUBINDX = INDEX_4              M   LVL 05  LINE  00000 COL 00032 - 00040

        MASK =                      RC Y LINE       -       COL       -     

  03 SUBINDX = INDEX_5              M   LVL 03  LINE  00002 COL 00027 - 00045

        MASK =                      RC Y LINE       -       COL     -       

  04 SUBINDX = INDEX_6              M   LVL 04  LINE  00000 COL 00047 - 00055

        MASK =                      RC N LINE       -       COL       -     

  04 SUBINDX = INDEX_7              M   LVL 04  LINE  00000 COL 00057 - 00070

        MASK =                      RC N LINE       -       COL       -     

  05 SUBINDX = INDEX_8              M   LVL 05  LINE  00000 COL 00072 - 00080

        MASK =                      RC N LINE       -       COL       -     

     SUBINDX =                      M   LVL     LINE        COL       -     

        MASK =                      RC Y LINE       -       COL       -     

============================================================================

                              INDEX LEVEL DISPLAY

      MAIN / INDEX_1 / INDEX_2 / INDEX_3 / INDEX_4

      MAIN / INDEX_1 / INDEX_5 / INDEX_6

      MAIN / INDEX_1 / INDEX_5 / INDEX_7 / INDEX_8

============================================================================

======= >>>>>>>>> END OF JOB/REPORT PARAMETERS FOR THIS CATEGORY <<<<<<< ====

FILL IN REPORT DEFINITION. CMDS: EDIT, SCHED, SHPF, PATH, CAPS       08.55.42

If subindexes 5, 6, 7 and 8 had been specified immediately after subindex 2, the user could blank out the specification of subindex 2, re-specify it at level 03 after subindex 8, and then specify subindexes 3 and 4.

Example 2

This example illustrates a moderately shallow and broad index hierarchy.

Index Level

01                main

               /        \

02            1          5

            /   \      /   \

03           2  3  4      6  7  8

To create this hierarchy, the user defines the following DO INDEX/SUBINDX statements. The Index Level Display is automatically generated as each index path is completed.

Figure 243 DO INDEX Parameter – Example 2

----- CONTROL-D/V CATEGORY NDX126              JOB  NDXTST2  ----------- (R.S)

COMMAND ===>                                                   SCROLL===> CRSR

+-------------------------------------------------------------------------------+

============================================================================

  DO INDEX   = MAIN                 M   R   G   LINE  00001 COL 00004 - 00005

        MASK =                      RC N LINE       -       COL       -     

  02 SUBINDX = INDEX_1              M   LVL 02  LINE  00001 COL 00007 - 00025

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_2              M   LVL 03  LINE  00001 COL 00027 - 00055

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_3              M   LVL 03  LINE  00001 COL 00057 - 00060

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_4              M   LVL 03  LINE  00002 COL 00004 - 00023

        MASK =                      RC N LINE       -       COL       -     

  02 SUBINDX = INDEX_5              m   LVL 02  LINE  00002 COL 00025 - 00039

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_6              M   LVL 03  LINE  00002 COL 00041 - 00060

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_7              M   LVL 03  LINE  00003 COL 00004 - 00015

        MASK =                      RC N LINE       -       COL       -     

  03 SUBINDX = INDEX_8              M   LVL 03  LINE  00003 COL 00017 - 00018

        MASK =                      RC N LINE       -       COL       -     

============================================================================

                              INDEX LEVEL DISPLAY

      MAIN / INDEX_1 / INDEX_2

      MAIN / INDEX_1 / INDEX_3

      MAIN / INDEX_1 / INDEX_4

      MAIN / INDEX_5 / INDEX_6

      MAIN / INDEX_5 / INDEX_7

      MAIN / INDEX_5 / INDEX_8

============================================================================

======= >>>>>>>>> END OF JOB/REPORT PARAMETERS FOR THIS CATEGORY <<<<<<< =====

FILL IN REPORT DEFINITION. CMDS: EDIT, SCHED, SHPF, PATH               16.15.28

If any index is deleted by erasing (blanking out) its specification, its subindexes are automatically deleted. For example, deleting subindex 5 automatically deletes subindexes 6, 7 and 8 in both examples above.

For an example of subindex specification using realistic index names, see PATH Command.

Example 3

This example illustrates the usage of page level, record level, and continuous record level indexes.

The decollation mission below decollates an inventory report sorted by a warehouse identifier (in columns 16-19 of line 4), and then by part number (in columns 2-12 of any line). A new report page occurs whenever the previous page is full or the warehouse identifier changes.

Indexed fields of the report to be decollated in this example look like this:

WAREHOUSE     WH01

1111-111-11  DESCRIPTION OF PART 11

2222-222-22  DESCRIPTION OF PART 22

WAREHOUSE     WH02

2222-222-22  DESCRIPTION OF PART 22

3333-333-33  DESCRIPTION OF PART 33

In the WAREHOUSE / ITEM-NUM / ITEM-DESC path, main index WAREHOUSE is specified as page level (RC=N). Subindexes ITEM-NUM and ITEM-DESC are specified as record level non-continuous (RC=Y). Any line (record) which does not have a value for these subindexes does not "inherit" the value of a prior line.

In this example, the index hierarchy whose main index is WAREHOUSE contains the following values:

WAREHOUSE     ITEM-NUM     ITEM-DESC

WH01          1111-111-11  DESCRIPTION OF PART 11

              2222-222-22  DESCRIPTION OF PART 22

WH02          2222-222-22  DESCRIPTION OF PART 22

              3333-333-33  DESCRIPTION OF PART 33

The value WHO2 2222-222-22 points to line 2222-222-22 DESCRIPTION OF PART 22. If index ITEM-NUM had been specified as RC=C (continuous), then this value would point to two lines:

WAREHOUSE     WH02

2222-222-22  DESCRIPTION OF PART 22

In the ITEM-NUM / WAREHOUSE path, subindex WAREHOUSE is specified as continuous (RC=C). Therefore, the last identified WAREHOUSE value is associated with each part number even though the WAREHOUSE value only occurs once prior to the records for all the parts which are located in that warehouse. Main index ITEM-NUM is specified as record-level (RC=Y). Records which contain only a WAREHOUSE value does not "inherit" the ITEM-NUM value from the previous record.

In this example, the index hierarchy whose main index is ITEM-NUM contains the following values:

ITEM-NUM     WAREHOUSE

1111-111-11  WH01

2222-222-22  WH01

2222-222-22  WH02

3333-333-33  WH02

Figure 244 DO INDEX Parameter – Example 3

----- CONTROL-D/V CATEGORY DAILY               JOB  PARTLST  ---------- (R.S)

COMMAND ===>                                                  SCROLL===> CRSR

+---------------------------------------------------------------------------+

| CATEGORY DAILY                  JOBNAME PARTLST   GENERIC    MONITOR 1    |

| ========================================================================= |

| DEF COPIES 01 LVL    USER INVTDPT              DEST          MAX COPIES   |

| ========================================================================= |

| ON CLASS      = S         EXTWTR               DEST          FORM         |

| PRT COPIES    LVL    USER                      DEST          MAX COPIES   |

|     PRINT/CDAM PARMS =                                                    |

| WHEN LINE 00003 - 00003 COL 00034 - 00050 PRINT   REF NXT   CT     AND/OR |

|      STRING = INVENTORY REPORT                                            |

| DO USER    = ACCTG                    LVL    LINE        COL       -      |

|                         S N T         SYNONYM =       CONCAT =            |

| DO NAME    = INVENTORY REPORT                                             |

| DO INDEX   = WAREHOUSE           M   R   G   LINE +00000 COL 00016 - 00019|

|       MASK = WAREHOUSE           RC N LINE 00004 - 00004 COL 00002 - 00010|

| 02 SUBINDX = ITEM-NUM            M   LVL 02  LINE +00000 COL 00002 - 00012|

|       MASK = ####-###-##         RC Y LINE 00001 - 00200 COL 00002 - 00012|

| 03 SUBINDX = ITEM-DESC           M   LVL 03  LINE +00000 COL 00015 - 00035|

|       MASK =  *                  RC Y LINE 00001 - 00200 COL 00002 - 00012|

|    SUBINDX =                     M   LVL     LINE        COL       -      |

|       MASK =                     RC   LINE       -       COL       -      |

| ========================================================================= |

|                           INDEX LEVEL DISPLAY                             |

|   WAREHOUSE / ITEM-NUM                                                    |

|   WAREHOUSE / ITEM-DESC                                                   |

| ========================================================================= |

| DO INDEX   = ITEM-DESC           M   R   G   LINE +00000 COL 00015 - 00035|

|       MASK = ####-###-##         RC N LINE 00001 - 00200 COL 00002 - 00012|

| 02 SUBINDX = WAREHOUSE           M   LVL 02  LINE +00000 COL 00016 - 00019|

|       MASK = WAREHOUSE           RC N LINE 00001 - 00200 COL 00002 - 00012|

|       MASK = WAREHOUSE           RC N LINE 00004 - 00004 COL 00002 - 00010|

|    SUBINDX =                     M   LVL     LINE        COL       -      |

|       MASK =                     RC          LINE-       COL       -      |

| ==========================================================================|

|                           INDEX LEVEL DISPLAY                             |

|   ITEM-DESC / WAREHOUSE                                                   |

| ==========================================================================|

FILL IN REPORT DEFINITION. CMDS: EDIT, SCHED, SHPF, PATH             11.29.29

Example 4

If a main index is specified as record level (RC=Y) and the report has header lines, the absence of indexable values in the header lines could cause the last found value for that index to improperly point to the next following page. This can be avoided by excluding the header lines from the line range of the index value mask.

In this example, every report page has 3 title lines followed by 57 data lines. The main index is record level (RC=Y). Enter LINE=+000 and specify a line range of 004-060 for that main index’s value mask.

If a value for the main index is found on the first data line of the current page (line 004), the page range pointed to by the last previously found value for that index does not include the current page because values for that index are not extracted from the first 3 lines of each page.

Example 5

This example illustrates the use of a DO INDEX statement with relative column and line values. As a result of the setting of the MASK subparameter, the index value for the report is extracted from the 10 characters that follow the NAME= string after this string is found in lines 1 through 5 and columns 11 through 30.

Figure 245 DO INDEX Parameter – Example 5

----- CONTROL-D/V CATEGORY NDX11232             JOB  NDXTST1  ----------- (R.S)

COMMAND ===>                                                    SCROLL===> CRSR

+-----------------------------------------------------------------------------+

===========================================================================

  DO INDEX   = NAME                 M   R   G   LINE +00000 COL +0005 - 00010

        MASK = *NAME=*              RC N LINE 00001 - 00005 COL 00011 - 00030

Example 6

This example illustrates the use of a DO INDEX statement in VAR format to extract an index value from the %%BANK variable. The previous DO SET statement sets the variable value as a concatenation of two strings that are in two different lines of the report.

Figure 246 DO INDEX Parameter – Example 6

----- CONTROL-D/V CATEGORY NDX11232             JOB  NDXTST1  ----------- (R.S)

COMMAND ===>                                                    SCROLL===> CRSR

+-----------------------------------------------------------------------------+

===========================================================================

  DO SET     = %%BANK    =*     LINE 00001 COL   00001  -  00005     C Y CS

  DO         = *                LINE 00002 COL   00001  -  00005     C   CS

  DO INDEX   = BANK                    R   G     VAR  %%BANK(1,10)           

        MASK =                  RC N LINE               -  COL         -     

Example 7

This example shows how to create a multi-value index from one range according to a mask. The decollated indexing report appears as follows:

Figure 247 DO INDEX Parameter – Example 7

1        TRANSFER REPORT                                                       

  from warehouse NO: 1001 (NEW YORK) to warehouse NO: 1002 (CHICAGO)

  ITEM NO. 1233-781-20 (A) 1233-781-21 1233-781-22 1233-781-23 (A)

  1233-781-24 1233-781-25 1233-781-26 1233-781-27 (A) 1233-781-28

The decollation mission below shows the definition of the WAREHOUSE page level index and the ITEM-NUM record level index on the page. Two values (1001 and 1002) of WAREHOUSE and 9 values (from 1233-781-20 until 1233-781-28) of ITEM-NUM will be assigned for this page. Both values of ITEM-NUM are connected to both values of WAREHOUSE.

DO INDEX   = WAREHOUSE            M M R _ G _ LINE +00000 COL +0004 - 00004

      MASK = *NO: ####*           RC N LINE 00002 - 00002 COL 00002 - 00070

02 SUBINDX = ITEM-NUM             M M LVL 02  LINE +00000 COL +0000 - 00011

      MASK = *####-###-##*        RC Y LINE 00003 - 00060 COL 00003 - 00070

Example 8

This example shows how to create a multi-value index from additional value ranges. The decollated indexing report appears as follows:

Figure 248 DO INDEX Parameter – Example 8

1 REPORT: TRANSFER

  FROM 1001 TO 1002

  TRANSFERRED ITEMS:

  1233-781-20

  1233-781-21

The two decollation missions below show the definition of the WAREHOUSE page level index and the ITEM-NUM record level index on the page. Two values (1001 and 1002) of WAREHOUSE and two values (1233-781-21 and 1233-781-22) of ITEM-NUM are assigned for this page. Both values of ITEM-NUM will be connected to both values of WAREHOUSE.

The WAREHOUSE is defined as a main index in the decollation mission below.

DO INDEX   = WAREHOUSE            M A R _ G _ LINE  00002 COL 00008 - 00011

      MASK =                      RC N LINE       -       COL       -      

   AND                            M _         LINE  00002 COL 00016 - 00019

      MASK =                           LINE       -       COL       -      

02 SUBINDX = ITEM-NUM             M _ LVL 02  LINE +00000 COL 00003 - 00013

      MASK = ####-###-##          RC Y LINE 00004 - 00060 COL 00003 - 00013

The WAREHOUSE is defined as a subindex of the REPORT main index in the decollation mission below.

DO INDEX   = REPORT               M _ R _ G _ LINE  00001 COL 00011 - 00020

      MASK =                      RC N LINE       -       COL       -      

02 SUBINDX = WAREHOUSE            M A LVL 02  LINE  00002 COL 00008 - 00011

      MASK =                      RC N LINE       -       COL       -      

   AND                            M _         LINE  00002 COL 00016 - 00019

      MASK =                           LINE       -       COL       -      

02 SUBINDX = ITEM-NUM             M _         LINE +00000 COL 00003 - 00013

      MASK = ####-###-##          RC Y LINE 00004 - 00060 COL 00003 - 00013

Example 9

This example shows how to create a multi-value index with separate subindex values. The decollated indexing report appears as follows:

Figure 249 DO INDEX Parameter – Example 9

1                  INVENTORY REPORT               :                  INVENTORY REPORT                     

  WAREHOUSE NO: 1001                              : WAREHOUSE NO: 1002      

              SHELF   QNTY   QNTY       QNTY      :             SHELF   QNTY   QNTY       QNTY  

  ITEM NO.    LIFE    UNIT   AVAIL      ORDER     : ITEM NO.    LIFE    UNIT   AVAIL      ORDER

  ----------- -----   ----   -------    -------   : ----------- -----   ----   -------    -------

  1233-781-21 NONE    KG      100.00     250.00   : 1233-781-31 NONE    KG      100.00     250.00

  1233-781-22 NONE    KG      500.00     500.00   : 1233-781-32 NONE    KG      100.00     100.00

The two decollation missions below show the definition of the WAREHOUSE page level index and the ITEM-NUM record level index on the page. Two values (1001 and 1002) of WAREHOUSE and four values (1233-781-21, 1233-781-31, 1233-781-22 and 1233-781-32) of ITEM-NUM will be assigned for this page. The two values of ITEM-NUM from the left part of the report (1233-781-21 and 1233-781-22) are connected to value 1001 of WAREHOUSE index, but two values from the right part (1233-781-31 and 1233-781-32) are connected to value 1002.

The WAREHOUSE is defined as main index in the decollation mission below.

DO INDEX   = WAREHOUSE            M T R _ G _ LINE  00002 COL 00017 - 00020

      MASK =                      RC N LINE       -       COL       -      

02 SUBINDX = ITEM-NUM             M T LVL 02  LINE +00000 COL 00003 - 00013

      MASK = ####-###-##          RC Y LINE 00005 - 00007 COL 00003 - 00013

DO INDEX   = WAREHOUSE            M T         LINE  00002 COL 00067 - 00080

      MASK =                           LINE       -       COL       -      

02 SUBINDX = ITEM-NUM             M T LVL 02  LINE +00000 COL 00053 - 00063

      MASK = ####-###-##               LINE 00005 - 00007 COL 00053 - 00063

The WAREHOUSE is defined as a subindex of the REPORT main index in the decollation mission below.

DO INDEX   = REPORT               M _ R _ G _ LINE  00001 COL 00020 - 00040

      MASK =                      RC N LINE       -       COL       -      

02 SUBINDX = WAREHOUSE            M T LVL 02  LINE  00002 COL 00017 - 00020

      MASK =                      RC N LINE       -       COL       -      

03 SUBINDX = ITEM-NUM             M T LVL 03  LINE +00000 COL 00003 - 00013

      MASK = ####-###-##          RC Y LINE 00005 - 00007 COL 00003 - 00013

02 SUBINDX = WAREHOUSE            M T LVL 02  LINE  00000 COL 00067 - 00080

      MASK =                           LINE       -       COL       -      

03 SUBINDX = ITEM-NUM             M T LVL 03  LINE +00000 COL 00053 - 00063

      MASK = ####-###-##               LINE 00005 - 00007 COL 00053 - 00063

Parent Topic

DO INDEX: Decollating Parameter (decollating mission)