ISeries - SQL stored procedure call from CL program

How to start a stored procedure from a CL program? RUNSQLSTM requires a source member, but I just want to create a command so that users can easily pass variables, so this will not work.

+3
source share
4 answers

You can call the system program QZDFMDB2and pass it one parameter with an executable SQL string. In this case, the SQL string is a call to your stored procedure:

  CALL PGM(QZDFMDB2) PARM('CALL PROCEDURE (''XYZ'', ''ABC'')')

To replace in your values, use the PARM variable:

  DCL VAR(&CALL) TYPE(*CHAR) LEN(200) 

  CHGVAR VAR(&CALL) 
  VALUE('CALL PROCEDURE (''' *CAT &PARM1 *TCAT ''', ''' *CAT &PARM2 *TCAT ''')')

  CALL PGM(QZDFMDB2) PARM(&CALL)
+5
source

There may be two options:

CL -. SQL . RUNSQLSTM .

- CL, RPG/COBOL. SQL . .

+3

- , - , . , :

, .

+2

QCMDEXC , .

0

Source: https://habr.com/ru/post/1698875/


All Articles