gtpg2m0vGeneral Macros

CM0PR-Scan Input Message for Keywords

Use this general macro, with the CM0ND macro to scan an input message for keyword commands. The CM0PR macro is passed a pointer to a table of expected keywords generated by CM0ND and a pointer to the input message to scan. The CM0PR macro scans the input message for the presence of one of the keywords. This macro skips insignificant characters: blank, comma (,), right parenthesis ()), hyphen (-), and equal sign (=).

Format




label
A symbolic name can be assigned to the macro statement.

LIST
This parameter specifies the pointer to the table of expected keywords generated by CM0ND. The valid inputs are:

label1
A symbolic address of the table.

(Rx)
A general register (other than R0 and R15) containing the address of the table.

Note:
The LIST parameter has no defaults.

DATA
This parameter specifies the pointer to the input message being scanned. The valid inputs are:

(Rx)
A general register (other than R0, R14 and R15) containing the address of the input message being scanned.

Note:
If the DATA parameter is omitted, R1 is assumed to be the pointer to the input message block.

RETURN
This specifies the address of a branch vector list to be given control upon completion of the macro. The first branch vector in the list is always given control if no keyword is found in the input message or end-of-message is detected. If the first keyword in the table is found in the input message, then control is given to the second branch vector. If the second keyword in the table is found in the input message, then control is given to the third branch vector, and so on. The valid inputs are:

(Rx)
This is a general register (other than R0, R14 and R15) containing the address of the branch vector list.

(NO)
The branch vector list is assumed to be coded at the next sequential instruction.

Note:
If the RETURN parameter is omitted, the (NO) option is assumed.

BV
This specifies the register that is to contain the branch vector at the completion of the macro. The valid inputs are:

(Rx)
This is a general register that contains the branch vector resulting from the scan. If this parameter is coded, control will be either given to the NSI or to the address specified in the RETURN parameter. It will be the responsibility of the calling program to perform the appropriate indexing into a branch vector list according to the contents of Rx.

(NO)
No register is to be loaded with the branch vector.

Note:
If the BV parameter is omitted, the (NO) option is assumed.

Entry Requirements

Return Conditions

Programming Considerations

Examples

In all the examples the following assumptions will be made:

Using the LIST parameter with the label option:

CM0PR LIST=TABLE1,DATA=(R3)
B     ERRORTN       BV for no match or EOM condition
B     DISPRTN       BV for DISplay keyword
B     STRTRTN       BV for START   keyword
B     DEFNRTN       BV for DEFine  keyword
B     LOCTRTN       BV for LOCate  keyword

Using the LIST parameter with the (Rx) option:

LA    R2,TABLE2     Get address of TABLE2
CM0PR LIST=(R2),DATA=(R3)
B     ERRORTN       BV for no match or EOM condition
B     STATRTN       BV for STAtus    keyword
B     RESCRTN       BV for RESources keyword
B     BUFFRTN       BV for BUFfer    keyword

Using the CM0PR macro in a subroutine and the RETURN parameter:

LA    R2,TABLE1     Get address of TABLE1
BAS   R7,SCANRTN    Go scan for keywords from TABLE1
B     ERRORTN       BV for no match or EOM condition
B     DISPRTN       BV for DISplay keyword
B     STRTRTN       BV for START   keyword
B     DEFNRTN       BV for DEFine  keyword
B     LOCTRTN       BV for LOCate  keyword
.
.
LA    R2,TABLE2     Get address of TABLE2
BAS   R7,SCANRTN    Go scan for keywords from TABLE2
B     ERRORTN       BV for no match or EOM condition
B     STATRTN       BV for STAtus    keyword
B     RESCRTN       BV for RESources keyword
B     BUFFRTN       BV for BUFfer    keyword
.
.
SCANRTN  DS    0H
CM0PR LIST=(R2),DATA=(R3),RETURN=(R7)

Calling the CM0PR macro in PGMY from PGMX and the BV parameter:

BEGIN NAME=PGMX
.
.
LA    R2,TBLINDX2   Set table index for TABLE2
ENTRC PGMY          Go scan for keywords from TABLE1
B     *+4(R1)       Branch using the branch vector
B     ERRORTN       BV for no match or EOM condition
B     STATRTN       BV for STAtus    keyword
B     RESCRTN       BV for RESources keyword
B     BUFFRTN       BV for BUFfer    keyword
.
.
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
BEGIN NAME=PGMY
.
initialize R2 to point to correct keyword
table according to the supplied table index.
.
CM0PR LIST=(R2),DATA=(R3),BV=(R1)
BACKC               Return to calling program