× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Good day,

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;
}
----------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.