HP 3000 Manuals

LIST [ HP Transact Documentation Update Notice ] MPE/iX 5.5 Documentation


HP Transact Documentation Update Notice

LIST 

Adds item names to list, key, match, and/or update registers.

Syntax 

LIST[(modifier)] item-name [,option-list][:item-name[,option-list]]...;

LIST adds data item names to the list, key, match, and/or update
registers.  The register affected depends on the verb modifier.  You can
choose from the following:

none       Adds specified item name to list register, reserves space,
           and, optionally, places value in data register.  (See Syntax
           Option 1.)

AUTO       Adds the names of all items in a dictionary associated with
           the specified file to the list register or adds all items
           defined in the program plus all items resolved from the
           dictionary to the list register.  (See Syntax Option 2.)

KEY        Places specified item name in key register.  (See Syntax
           Option 3.)

MATCH      Adds specified item name to list register and copies existing
           value for that item from the data register to the match
           register.  (See Syntax Option 4.)

PATH       Adds specified item name to list register and places it in key
           register.  (See Syntax Option 5.)

UPDATE     Adds specified item name to list register and copies value for
           that item from the data register to the update register.  (See
           Syntax Option 6.)

Consider the following when setting up your list register:

   *   For use with database access, list items may be in any position in
       the register.  However, consecutive order allows simpler range
       lists in the data management statements.

   *   For use with KSAM or MPE files or VPLUS forms, list items can be
       in any position in the register.  However, with the LIST= option,
       the items must be specified in the same order as the items occur
       in the physical file or form.

   *   Child item names cannot be specified as list items in a LIST
       statement.  Instead, the associated parent item name must be
       specified.

   *   System variables cannot be put in a LIST statement.  They can only
       be used in DISPLAY or FORMAT statements.

   *   See Chapter 4, "Transact Registers," for a discussion of adding
       items to the LIST register multiple times.

Statement Parts 

modifier   A change or enhancement to the action of LIST; often the
           register to which the input value should be added or the
           register whose value should be changed.

item-name  The item-name to be added or changed in the list, key, match,
           or update registers; must not be a child item name.

option-    Values specific to Syntax Options (1) and (3).
list 

Syntax Options 

(1) LIST item-name[,option-list]

LIST with no modifier adds the item-name to the list register and
reserves space in the data register.  If you do not include an option
from the list below, Transact does not change the original contents of
the data register.  If you choose an option from the list below, it
places the corresponding value in the data register.

option-    Specifies a value to be placed in the data register.  Note
list       that the options listed below are not variable names and need
           not be defined in a DEFINE(ITEM) statement or in a dictionary.
           The formats of these options are not affected by the choice of
           language in the SET(LANGUAGE) statement.

           ACCOUNT       An X(8) item that contains the account name from
                         the system log on.

           ALIGN         Forces the item to be aligned on a 16-bit
                         boundary on Transact/V and on a 32-bit boundary
                         on Transact/iX.

                         _______________________________________________ 

                         NOTE  Only compile time alignment is supported.

                         _______________________________________________ 

           DATE          An X(6) item that contains the current system
                         date in MMDDYY format.  If the data item size is
                         not six characters, then truncation or blank
                         fill occurs.  This option is normally used to
                         set up a data item that is to contain the
                         current date.

           DATE/C        An X(8) item that contains the current system
                         date in YYYYMMDD format.

           DATE/D        An X(6) item that contains the current system
                         date in DDMMYY format.

           DATE/J        An X(5) item that contains the current system
                         date in Julian YYDDD format.

           DATE/L        An X(27) item that contains the current system
                         date/time message.

           DATE/Y        An X(6) item that contains the current system
                         date in YYMMDD format.

           GROUP         An X(8) item that contains the group name from
                         system log on.

           HOME- GROUP   An X(8) item that contains the home group of the
                         logged on user.

           INIT[IALIZE]  Blanks if the data item type is an alphanumeric
                         string, or binary zero for all other types.

           PASSWORD      An X(8) item that contains the first password
                         value entered during Transact system log on.

           PROCTIME      An I(9) item that contains the 32-bit integer of
                         process CPU time in milliseconds.

           TERMID        An I(4) item that contains the terminal logical
                         device number.

           TIME          An X(8) item that contains the current time in
                         HHMMSSTT format.

           TIMER         An I(9) item that contains the 32-bit integer of
                         system time in milliseconds.

           SESSION       An X(1) item than contains an "S" or a "J" to
                         indicate that the current process is running as
                         a session or a job, respectively.

           USER          An X(8) item that contains the user name from
                         the system logon.

For example, the following statements define the item MYPASS, move it to
the list register, allocate it space in the data register, and place the
user's password in that space:

     DEFINE(ITEM) MYPASS X(8);
     LIST MYPASS, PASSWORD;

(2) LIST(AUTO) {file-name[,option-list];
                        {          @[,option-list];

LIST(AUTO) file-name adds the names of all the items in the specified
file to the list register.  file-name can refer to a form, a file, or a
data set, but not a database or forms file.  Transact uses the dictionary
to acquire the item names, and a compiler error results if file-name is
not defined in a dictionary or if it has no item names associated with
it.  Alias definitions are not retrieved from the dictionary.

The option INIT sets blanks to the data item if its type is an
alphanumeric string or sets binary zero to the data item for all other
data types.  When the DEFN option is used during program compilation, all
item names in the specified file will be included in the compile listing
and it will give the name and relative list register position of each
item.

The option ALIGN forces the item to be aligned on a 16-bit boundary on
Transact/V and on a 32-bit boundary on Transact/iX. The first item with
LIST(AUTO) filename,ALIGN will be aligned.

LIST(AUTO) @ causes Transact to place all the user-defined data items in
the program into the list register in the order in which they are
encountered during compilation.  This includes items resolved from the
dictionary.  The option INIT sets blanks to the data item if its type is
an alphanumeric string or sets binary zero to the data item for all other
data types.  All items with LIST(AUTO)@,ALIGN will be aligned.

When multiple LIST(AUTO) statements are issued for different files that
have some items in common, you must ensure that the resultant structure
of the list register will support the statements that follow.

(3) LIST(KEY) item-name;

LIST(KEY) places item-name in the key register only.

(4) LIST(MATCH) item-name[,option-list];

LIST(MATCH) adds item-name to the list register and copies the existing
value from the data register into the match register as a selection
criterion for subsequent file or data set operations.  MATCH is typically
used when a previous retrieval operation has placed a value in the data
register and that value is now to be used for the next selection
criterion.  The item-name for the new data item list may differ from the
item-name used for the previous retrieval.  Matching with alphanumeric
data is affected by the native language set by a SET(LANGUAGE) statement.
For more information, see Appendix E, "Native Language Support."

The following values for option-list specify a match selection to be
performed on a basis other than equality.

option-    Any of the following options can be selected:
list:

           ALIGN         Forces the item to be aligned on a 16-bit
                         boundary in Transact/V and on a 32-bit boundary
                         in Transact/iX
           NE            Not equal to
           LT            Less than
           LE            Less than or equal to
           GT            Greater than
           GE            Greater than or equal to
           LEADER        Matched item must begin with the input string;
                         equivalent to the use of trailing "^" on input
           SCAN          Matched item must contain the input string;
                         equivalent to the use of trailing "^^" on input
           TRAILER       Matched item must end with the input string;
                         equivalent to the use of a leading "^" on input

(5) LIST(PATH) item-name[,option-list];

LIST(PATH) adds item-name to the list register and places it in the key
register.

The ALIGN option forces the item to be aligned on a 16-bit boundary in
Transact/V and on a 32-bit boundary in Transact/iX.

(6) LIST(UPDATE) item-name[,option-name];

LIST(UPDATE) adds item-name to the list register and places the value
already in the data register into the update register for a subsequent
data set or file operation using the REPLACE verb.

The ALIGN option forces the item to be aligned on a 16-bit boundary in
Transact/V and on a 32-bit boundary in Transact/iX.

Examples 

The first example places item names NAME, ADDRESS, CITY, and DATE in the
list register and reserves areas for their values in the data register.
The areas for NAME, ADDRESS, and CITY are initialized to blanks and the
area for DATE is initialized to the current system date in MMDDYY format.

     DEFINE(ITEM) NAME X(20):
                  ADDRESS X(20):
                  CITY X(10):
                  DATE X(6);
     LIST NAME,INIT:
          ADDRESS,INIT:
          CITY,INIT:
          DATE,DATE;

The data register is your stack.  It is never cleared; it is only mapped
and remapped through the list register.  To illustrate this point,
consider the following example that references two databases.  In one, a
customer name is identified by two items, LAST-NAME and FIRST-NAME; in
the other, the same name is identified by a single item, CUST-NAME.

     SYSTEM TEST1,
            BASE=CUST-BASE,
                 PROD-BASE;
     DEFINE(ITEM)  LAST-NAME   X(10):
                   FIRST-NAME  X(10):
                   CUST-NAME   X(20);

     LIST LAST-NAME: FIRST-NAME;    <<Map data register with LIST statement>>

     GET CUST-MAST,
     LIST=(LAST-NAME:FIRST-NAME);   <<Retrieve name, move to data register >>

     RESET(STACK) LIST;             <<Reset list register to its beginning >>

     LIST CUST-NAME;                <<Map same data with new list register >>

     PUT CUST-INFO(PROD-BASE),
         LIST=(CUST-NAME);          <<Write name to other database         >>

     END TEST1;

Note that the list register was reset programmatically with the
RESET(STACK) statement.

The next example shows the use of LIST(AUTO) to include all defined items
in the list register and initialize them.

     LIST(AUTO) @,INIT;

The next example is used to put dictionary items for a file in the list
register.

     LIST(AUTO) PASSENGER-DTL;

In the next example, the company code is used to retrieve and display
data from one data set (CO-MSTR) and then the same value, renamed by
LIST(PATH) as the department code, is used to access another data set
(DEPT-MSTR).

     PROMPT(PATH) COMPANY-CODE,   <<Get company code for subsequent retrieval>>
          CHECK=CO-MSTR;          <<from CO-MSTR data set                    >>
     LIST A:
          B:
          C;
     OUTPUT CO-MSTR;
     RESET(STACK) LIST;
     LIST(PATH) DEPT-CODE;        <<Use same value as department code for    >>
     LIST X:                      <<subsequent retrieval from DEPT-MSTR      >>
          Y:
          Z;
     OUTPUT DEPT-MSTR;

In the following example, Transact resets the list register automatically
when a new command sequence starts.  Because Transact resets the list
register at the start of each new command sequence, you should define any
global variables before the first command sequence, and then redefine the
global variables within each command sequence preceding any local
variables.  For example, suppose the variables, "VENDOR-ID" and
"VENDOR-NAME" are to be used by both sequences UPDATE PRODUCT and UPDATE
VENDOR. Before executing either sequence, you can define these items and
place values for them in the data register.  In order to retain these
values, all you need do is remap the list register at the start of each
sequence.

     LIST VENDOR-ID:              << Map global variables in list reg.       >>
          VENDOR-NAME;
     DATA VENDOR-ID:              << Prompt user for data                    >>
          VENDOR-NAME;

     $$UPDATE:                    << New command sequence -                  >>
      $PRODUCT:                   << Transact resets list register           >>
        LIST VENDOR-ID:           << Remap global variables                  >>
             VENDOR-NAME:
             PROD-NUM:            << Variables local to UPDATE PRODUCT       >>
             DESCRIPTION;

      $VENDOR:                    << Transact resets list register again     >>
        LIST VENDOR-ID:           << Remap global variables                  >>
             VENDOR-NAME:
             VENDOR-ADDRESS:      << Variables local to UPDATE VENDOR        >>
             VENDOR-ZIP;

The next example shows how the DATE/C option is used.

     SYSTEM DATES;

       DEFINE(ITEM) TODAYS-DATE  X(8):
                    TODAYS-YEAR  X(4)   = TODAYS-DATE(1):
                    TODAYS-MONTH X(2)   = TODAYS-DATE(5):
                    TODAYS-DAY   X(2)   = TODAYS-DATE(7);

       LIST TODAYS-DATE, DATE/C;

       DISPLAY "TODAY'S DATE:
     ":TODAYS-DATE,NOHEAD,EDIT="^^^^/^^/^^";

       DISPLAY "FORMATTED DATE: ", LINE=2:
               TODAYS-MONTH, NOHEAD, SPACE=0:
               "/", SPACE=0:
               TODAYS-DAY,   NOHEAD, SPACE=0:
               "/", SPACE=0:
               TODAYS-YEAR,. NOHEAD, SPACE=0;
       EXIT;

The output from this example is:

     TODAY'S DATE: 1992/08/18

     FORMATTED DATE: 08/18/1992

The last example shows how the ALIGN option causes item1 and item3 to be
word-aligned in the list register.  Item2 will follow item1 and may or
may not be aligned, depending on length of item1.

     LIST item1,ALIGN;
          item2;
          item3,INIT,ALIGN;



MPE/iX 5.5 Documentation