Asked by Anonymous - Mainframe Cobol code calling external stored procedure example:
The following shows an example of a cobol program calling a stored procedure.
Assume your stored proc has been defined in sysibm.sysroutines and sysibm.sysparms first as it needs to be setup of course.
NAME SAMPLESP
FENCED Y
STAYRESIDENT Y
ROUTINETYPE P
LANGUAGE COBOL
PROGRAM_TYPE S
You will define working storage something like this:
01 WS-PASS-DATA PIC X(500) VALUE SPACES.
Then down in your cobol code:
INITIALIZE WS-PASS-DATA
MOVE .... your WS ......... TO WS-PASS-DATA
EXEC SQL
CALL SAMPLESP(:WS-PASS-DATA)
END-EXEC
EVALUATE SQLCODE
WHEN 0
MOVE WS-PASS-DATA TO WS-YOUR-RETURN
IF ... error code in your return data set
WHEN OTHER
Your error checking
END-EVALUATE
|
Add your reply below ...
|