1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

what is the equivalent const char* in cobol

Discussion in 'C' started by ronald, Jun 15, 2009.

  1. ronald

    ronald New Member

    Hi There,

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

  2. xpi0t0s

    xpi0t0s Mentor

    Which version of Cobol are you using (i.e. what compiler - include full details inc full version number and all that)?
  3. ronald

    ronald New 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?
  4. xpi0t0s

    xpi0t0s 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)?
  5. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~


    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 *.

Share This Page