% LOOKUP

Reference a % DECLARE table.
Restriction: This topic applies only when the AppMaster Builder AddPack has been installed, and applies only to Windows platforms.

Syntax:

 % LOOKUP &declarepart oper searchval [FROM value [valueN 
...]]
     statementblock
[% ELSE-IF condition
     statementblock
          .
          .
          .
[% ELSE
     statementblock
[% END]

Parameters:

&declarepart Name of variable assignment in % DECLARE table.
condition Condition can be a number or variable, followed by a space and a relational operator, followed by a space and a value. To specify multiple conditions, use the Boolean operators AND or OR with no parentheses.

Relational operator can be =, NOT =, <, >, NOT <, NOT >, <=, >=.

Value can be a number, a literal enclosed in apostrophes or quotation marks, or a variable.

oper Valid operators =, NOT =, <, >, NOT <, NOT >, <=, >=.
searchval Customizer term.
value Starting value(s) of the low-order &subscript of the &fieldname associated with the &declarepart. Can be a constant, variable, or expression.

Comments:

  • % LOOKUP can increment up to 20 subscripts.
  • If FROM is not coded, the low-order &subscript in % DECLARE is the starting value that increments by 1 until the condition is satisfied or an undefined instance is found.
  • If the next-to-low-order DECLARE &subscript does not exist or is a string, then only the low-order &subscript enumerates by 1.

Examples:

Reference a % DECLARE table.

% DECLARE &IMS-PCB-(&PCBX)-SEG-(&SEGX)
    % &IMS-PCB-SEG-NAME                 X30
    % &IMS-PCB-SEG-IMSNAME              X8
    % &IMS-PCB-SEG-PROCOPTS
        % &IMS-PCB-SEG-PROCOPT-GET      N
        % &IMS-PCB-SEG-PROCOPT-ISRT     N
        % &IMS-PCB-SEG-PROCOPT-REPL     N
        % &IMS-PCB-SEG-PROCOPT-DLET     N
    % &IMS-PCB-SEG-LEN                  N6
                 .
                 .
% LOOKUP &IMS-PCB-SEG-NAME = &THE-SEG-NAME-YOU-WANT FROM 1 1
    do this if found
                 .
                 .
% ELSE
    do this if found
                 .
                 .
                 .

Address &declareparts of other % DECLARE structures that use some or all of the same &subscripts without an additional % LOOKUP. Strip blanks from &ALIAS before the % LOOKUP by parsing it with the function &PARSE.

% DECLARE &VS-(&VSX-FILE)-KEY-(&VSX-KEY)-B
    % &VSP-FILE-KEY-VOL           X8
    % &VSP-FILE-KEY-SPACE         X20
    % &VSP-FILE-KEY-CICZ          X20
% DECLARE &VS-(&VSX-FILE)-KEY-(&VSX-KEY)-ALIAS-(&VSX-ALIAS)
    % &VSP-FILE-KEY-ALIAS         X30
                 .
                 .
                 .
&ALIAS = &PARSE(&ALIAS)
                 .
                 .
                 .
% LOOKUP &VSP-FILE-KEY-ALIAS = &ALIAS FROM 1 1 1
    % &VOL = &VSP-FILE-KEY-VOL