IMSQUERY extended functions
The IMSQUERY function is available to query certain IMS information either on the environment or on the prior DL/I call.
The IMSQUERY function can be used to check for the return and reason codes after a synchronous callout request is made using the ICAL call. If the return or reason code indicates that partial output data is being returned, you can issue the IMSQUERY function to retrieve the output data length and the error extension codes.
Format
| Call Name | DB/DC | DBCTL | DCCTL | DB Batch | TM Batch |
|---|---|---|---|---|---|
| IMSQUERY | X | X | X | X | X |
Usage
The format of the function call is:
IMSQUERY('Argument') where Argument is one
of the values in the following list.- Argument
- Description of Data Returned
- ERRXTN
- The error extension code when an error response message is returned after a synchronous callout request is made using ICAL.
- FEEDBACK
- FEEDBACK area from current PCB.
- IMSRXTRC
- Current
IMSRXTRCtrace level #. - OUTLEN
- The output length of the response message when a partial response is returned after a synchronous callout request is made using ICAL.
- REASON
- Reason code from last call (from AIB if used on last REXXTDLI type call).
- SEGLEVEL
- Segment level from current PCB (Last REXXTDLI call must be against a DB PCB, or null is returned).
- SEGNAME
- Segment name from current PCB (Last REXXTDLI call must be against a DB PCB, or null is returned).
- STATUS
- IMS status code from last executed REXXTDLI call (DL/I call). This argument is the two character status code from the PCB.
- TRANCODE
- Current transaction code being processed, if available.
- USERID
- Input terminal's user ID, if available. If running in a non-message-driven region, the value is
dependent on the specification of the BMPUSID= keyword in the DFSDCxxx PROCLIB member:
- If BMPUSID=USERID is specified, the value from the USER= keyword on the JOB statement is used.
- If USER= is not specified on the JOB statement, the program's PSB name is used.
- If BMPUSID=PSBNAME is specified, or if BMPUSID= is not specified at all, the program's PSB name is used.
- ZZ
- ZZ (of LLZZ) from last REXXTDLI command. This argument can be used to save the ZZ value after
you issue a
GUcall to the I/O PCB when the transaction is conversational. - !token
- Address (in hexadecimal) and length of specified token (in decimal), separated by a blank.
This value can be placed in a variable or resolved
from an expression. In these cases, the quotation marks should be
omitted as shown below:
Token_Name="!MY_TOKEN"
AddrInfo=IMSQUERY(Token_Name)
/* or */
AddrInfo=IMSQUERY("!MY_TOKEN")Although the function argument is case-independent, no blanks are allowed within the function argument. You can use the REXX STRIP function on the argument, if necessary. IMSQUERY is the preferred syntax, however REXXIMS is supported and can be used, as well.
Example
If REXXIMS('STATUS')='GB' Then Signal End_Of_DB
⋮
Hold_ZZ = IMSQUERY('ZZ') /* Get current ZZ field*/
⋮
Parse Value IMSQUERY('!MYTOKEN') With My_Token_Addr My_Token_Len .