what is the equivalent const char* in cobol

ronald's Avatar, Join Date: Jun 2009
Newbie Member
Hi There,

does anyone know the equivalent data type in cobol for const char* var in C?

thanks
R
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Which version of Cobol are you using (i.e. what compiler - include full details inc full version number and all that)?
0
ronald's Avatar, Join Date: Jun 2009
Newbie Member
Microfocus 3.1 and I'm trying from Cobol to call a C++ dll which has a function with the following paramaters:
char *sSQL
const char *sDatabaseName.

Please note that the calling itself is ok (return no error). however, the error occurs at the end of the cobol program.

the following is the error:
114 attempt to access item beyond bounds of memory (signal 11).

If I tried to call only on char *sSQL (without const char *sDatabaseName) then it works.

any clue?
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Going by the variable names they both look like input variables (i.e. input to the DLL function). What does the function do with results?

The two variables will be represented the same way in the Cobol program; you can treat both as just char* and ignore the const. Const is just a contract that means the string won't be modified.

Can you reproduce the problem with a short Cobol program (say 10 lines or so in the PROCEDURE DIVISION)?
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~
Quote:
Originally Posted by ronald View Post
Please note that the calling itself is ok (return no error). however, the error occurs at the end of the cobol program.
Hmm..

Quote:
Originally Posted by ronald View Post
the following is the error:
114 attempt to access item beyond bounds of memory (signal 11).
That can't be caused by a missing const. Your program might be trying to access array index(es) beyond its size.
Could you please post your code.

BTW, const char * is nothing special. It's just the same char *. The only thing the const keyword does it, it makes the target func aware that it should not alter the char *.