s...@kiska.net
unread,May 6, 2013, 3:36:46 PM5/6/13You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi Gurus,
Here is the problem:
1. I have ILE COBOL program (*PGM) with let say 3 parameter
2. I am calling this program (dynamically) from other COBOL program let say
with 5 parameters - call is going thru, everything is okay.
3. I need to do the same call from C++ - I am getting MCH0802 (number of
parameters mismatch).
What is wrong and how to avoid that ?
Regards,
Sergey
-------------- CALLEE.CBL ------------
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLEE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
LINKAGE SECTION.
01 P1 PIC X(5).
01 P2 PIC X(5).
01 P3 PIC X(5).
PROCEDURE DIVISION USING P1 P2 P3.
0000-MAIN.
DISPLAY 'P1=' P1 ';'.
DISPLAY 'P2=' P2 ';'.
DISPLAY 'P3=' P3 ';'.
MOVE 'RET1' TO P1.
MOVE 'RET2' TO P2.
MOVE 'RET3' TO P3.
GOBACK.
--------------------------- CBCALLER.CBL -----------------
IDENTIFICATION DIVISION.
PROGRAM-ID. CALLER.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 P1 PIC X(5) VALUE 'PARM1'.
01 P2 PIC X(5) VALUE 'PARM2'.
01 P3 PIC X(5) VALUE 'PARM3'.
01 P4 PIC X(5) VALUE 'PARM4'.
01 P5 PIC X(5) VALUE 'PARM5'.
01 SUB PIC X(8) VALUE 'CALLEE'.
PROCEDURE DIVISION.
0000-MAIN.
DISPLAY 'P1=' P1 ';'.
DISPLAY 'P2=' P2 ';'.
DISPLAY 'P3=' P3 ';'.
DISPLAY 'P4=' P4 ';'.
DISPLAY 'P5=' P5 ';'.
DISPLAY 'CALL CALLEE'.
CALL SUB USING P1 P2 P3.
DISPLAY 'RETURN FROM CALLEE'.
DISPLAY 'P1=' P1 ';'.
DISPLAY 'P2=' P2 ';'.
DISPLAY 'P3=' P3 ';'.
DISPLAY 'P4=' P4 ';'.
DISPLAY 'P5=' P5 ';'.
GOBACK.
---------------------- CALLER.CPP ----------------------------
#include <miptrnam.h>
#include <except.h>
#include <stdio.h>
static char p1[6] = "parm1";
static char p2[6] = "parm2";
static char p3[6] = "parm3";
static char p4[6] = "parm4";
static char p5[6] = "parm5";
extern "OS" typedef void (OS_fct_t) (...);
int main(int argc, char * argv[])
{
OS_fct_t * os_fct_ptr;
#pragma exception_handler(Lnone, 0, _C1_ALL, _C2_ALL, _CTLA_HANDLE_NO_MSG)
os_fct_ptr = (OS_fct_t *) rslvsp(_Program, "CALLEE", "*LIBL",
_AUTH_OBJ_MGMT);
printf("Calling CALLEE with %s, %s, %s, %s, %s\n", p1, p2, p3, p4, p5);
os_fct_ptr(p1, p2, p3, p4, p5);
printf("CALLEE returned %s, %s, %s, %s, %s\n", p1, p2, p3, p4, p5);
return 0;
Lnone:
#pragma disable_handler
printf("Non-Resolved\n");
return 0;
}
----------------------------------------------