Support This Project Get i5/OS Programmer's Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads

CL Command INSIDX (Insert User Index)

Go back to main page of i5/OS Programmer's Toolkit.

CL command INSIDX is a member of i5/OS Programmer's Toolkit. The INSIDX command inserts an entry into a user index (*USRIDX) object whose MI object type and subtype is hex 0E0A.

Parameters of command INSIDX

Parameter Description
User Index Object (USRIDX) Name and library of the user index object (*USRIDX) object. The library name is default to *LIBL.

Entry data (ENTRY) Entry data to insert into the user index.

Entry length (ENTLEN) Length of entry data. For a fixed-length-entry user index object, the actural entry length of the user index will be used instead. Use CL command DSPIDXD to check the entry length attributes of a user index object.

Insert with replacement (REPLACE) Valid only for a keyed user index. Specify *YES to replace the nonkey portion of the index entry if the key is already in the user index. Specify *NO to insert the entry only if the key is not already in the user index.

Usage Examples

Create a *USRIDX object

To create a *USRIDX object, one may use API QUSCRTUI . For example

CALL PGM(QUSCRTUI) PARM(
     'INX1      LSBIN'    /* qualified *USRIDX name and library */
     'HELLO'              /* extended attribute */
     'V'                  /* entry length attribute: variable-length entries */
     X'FFFFFFFF'          /* entry length: -1 enables a maximum entry length
                                           of 2000 and a key length from 1
                                           through 2000. */
     '1'                  /* key insertion: yes*/
     X'00000008'          /* key length: 8 */
     '1'                  /* immediate update: yes */
     '0'                  /* optimization: optimize for random references */
     '*EXCLUDE'           /* public authority: *EXCLUDE */
     'var-length, key-length=8' /* text description */
     '*YES'               /* replace: yes */
     X'00000010000000000000000000000000' /* error code: 16 bytes */
     )

Insert an entry into a *USRIDX object

Example of using CL command INSIDX to insert an entry into a *USRIDX object

INSIDX USRIDX(*LIBL/INX1)
       ENTRY('0001000Ani hao :)')
       ENTLEN(17)
       REPLACE(*YES)      /* replace the nonkey portion of the index
                             entry if the key is already in the user
                             index. */

Examine Contents of a *USRIDX object

To examine what's in a *USRIDX object, one may use CL command DMPOBJ or DMPSYSOBJ. For example, issuing DMPOBJ command on the *USRIDX object we've just created.

DMPOBJ OBJ(INX1) OBJTYPE(*USRIDX)

We may get the following result. Refer to the 'INDEX ENTRIES' section to see what we've just inserted into the *USRIDX object.

 5722SS1 V5R2M0  071902                      AS/400 DUMP              302491/LJL/REDLIGHT        09/09/30 17:01:21        PAGE    1
 DMPOBJ PARAMETERS
 OBJ- INX1                            CONTEXT- LSBIN
 OBJTYPE- *USRIDX
 OBJECT TYPE-           INDEX                                           *USRIDX
 NAME-        INX1                            TYPE-          0E   SUBTYPE-          0A
 LIBRARY-     LSBIN                           TYPE-          04   SUBTYPE-          01
 CREATION-    09/09/30  16:58:51              SIZE-          0000005000
 OWNER-       LJL                             TYPE-          08   SUBTYPE-          01
 ATTRIBUTES-          0800                    ADDRESS-       3DF96FB351 000000
 INDEX ATTRIBUTES-
   000000   00FFF000 000000B0 0E0AC9D5 E7F14040   40404040 40404040 40404040 40404040  *  0    ^  INX1                  *
   000020   40404040 40404040 E0000000 00000000   00000E00 00800000 00000000 00000000  *        $                       *
   000040   00000000 00000000 22E9B508 1E000400   00000000 00000000 00000000 00000000  *         Z                     *
   000060   E5001100 08000000 01000000 00000000   01000000 00000000 00000000 00000000  *V                               *
   000080   00000000 00000000 00000000 00000000   00000000 00000000 00000000 00000000  *                                *
   0000A0   00000000 00000000 00000000 00000000                                        *                                *
 INDEX ENTRIES-
 . 000001-
   000000   F0F0F0F1 F0F0F0C1 95894088 8196407A   5D                                   *0001000Ani hao :)               *
 PRIMARY ASSOCIATED SPACE-
   000000   00000000 00000000 00000000 00000000   00000000 00000000 00000000 00000000  *                                *
         LINES  000020    TO    000DFF  SAME AS ABOVE
 .POINTERS-
   NONE
 OIR DATA-
 .TEXT-
   000000   A5819960 93859587 A3886B40 9285A885   846B4092 85A86093 85958788 A37EF840  *var-length, keyed, key-lenght=8 *
   000020   405CE8C5 E2                                                                * *YES                           *
 .SERVICE-
   000000   40404040 40404040 40404040 40404040   40404040 40F14040 40404040 40404040  *                     1          *
   000020   40404040 40404040 404040E5 F5D9F2D4   F0F1F0F9 F0F9F3F0 F1F6F5F8 F5F14040  *           V5R2M01090930165851  *
   000040   40404040 40404040 40404040 40404040   40404040 40404040 40404040 40404040  *                                *
   000060   40404040 40404040 40404040 40404040   40404040 40404040 00000000 00000000  *                                *
   000080   00000000 00000000 00000000 00000000   00000000 00000000 40400000 00000000  *                                *
   0000A0   00000000 00000000                                                          *                                *
 .ATTRIBUTE-
   000000   C8C5D3D3 D6                                                                *HELLO                           *
 .USAGE-
   000000   D3D1D340 40404040 4040F8F1 F0404040   40400000 00000000 0000               *LJL       810                   *
 END OF DUMP
 * * * *  E N D  O F  L I S T I N G  * * * * *

Screenshots

idx-2.png

Support This Project
Generated on Wed Jul 20 00:25:07 2011 for i5/OS Programmer's Toolkit: User Index Tools by  doxygen 1.5.9