A stored procedure that contains input and output parameters

In this example, the USERA.IOVCHAR stored procedure has two parameters (an input and an output parameter), which are both defined as VARCHAR 32 KB character strings. The stored procedure copies the input string to the output string.

You can enter your CALL statement with QMF global variables to handle the input and output parameters. The global variables can be declared by using the SET GLOBAL command before you run the CALL statement. If you do not set the value before you run the CALL statement, you are prompted to enter a value. Issue the CALL statement on the SQL QUERY panel. For example:


You enter your data on the lines that are provided in the prompt panel. You must enter a blank for the output parameter regardless of whether you use prompting or you set the global variables before you run the CALL statement. A blank value is shown for the output parameter &A02 in the following figure:

Figure 1. Run Command Prompt panel that shows input and output parameters
  SQL QUERY                                                    MODIFIED LINE  1  

                  RUN Command Prompt - Values of Variables        1 to 10 of 10

  Your RUN command runs a query or procedure with variables that need
  values.  Fill in a value for each variable named below:

  &A01             ‘This is my string’
  &A02             ‘ ‘

  F1=Help   F3=End   F7=Backward   F8=Forward

  Please give a variable for each variable name.

Upon completion, you see this message:

OK, your stored procedure has successfully completed. 

You can view the output parameter in the global variable pool by using the SHOW GLOBALS command. This command displays the GLOBALS panel, which is shown in the following figure:

Figure 2. Viewing the output parameters with the SHOW GLOBALS command

  Type a value for a global variable and press Enter or press a function
  key. Variable values may be changed if they are enclosed in parentheses
  or brackets.

  Variable Name:         Value:
  -------------------    ------------------------------------------------
                                                           1 to 11 of 113
  A02                    ( THIS IS MY STRING                      >
  DSQAO_APPL_TRACE         0
  DSQAO_ATTENTION          0
  DSQA)_BATCH              1

  1=Help   2=        3=End        4=      5=Show Field     6=Query
  7=Backward   8=Forward   9=Form   10=Add   11=Delete   12=Report
  COMMAND ===>