called program file not found in drive / directory SQLADR

I am getting the error 173 - Called program file not found in drive/directory SQLADR when running cobol v5  in Visual Studio 2019 using database Oracle 18, 32  bit.

I have put litlink in additional directives under COBOL (anim cobidy warnings"1" max-error"100" litlink) and have put the path to the oracle 18 lib in COBOL LINK 'link with libs'

That fixed the problem of connecting, but I still get the 173 called program file not found in drive / directory SQLADR when I try to call a program in another project.  This worked previously in VS 2013, cobol 2.3.

I do notice that there are only two references to microfocus in 'about' - IMTK client generator and cobol 5, where there used to be 6.

 

 

 

  • This error normally occurs on a SQL connect statement when the Oracle .dll is not being loaded. 

    Can you please clarify what you mean by the statement:
    "That fixed the problem of connecting, but I still get the 173 called program file not found in drive / directory SQLADR when I try to call a program in another project."

    Is the connect successful in the first program you reference?
    How exactly are you calling this other program?
    Do you do another connect in the called program?
    (This is normally where the error occurs)
    Is this other program a .dll which is also being compiled with litlink and the oracle lib being linked in?
    Is the ORASQL18.DLL within the system PATH?

    Another way to load the Oracle library which does not involve litlink is to add the following to the program doing the connect:
    01 pp procedure-pointer.

    set pp to entry "orasql18.dll"

     

  • Hi Chris,

    The connect is successful in the first program (in projectA) where litlink was used and the oracle lib path given. 

    I did get the first program to call the second, in projectB, and that worked.

    However, when, in the second program, it tried to execute EXEC SQL (for a count), the 173 occurred (projectB compiled for debug, but not using litlink or oracle lib)

    I added litlink and the oracle lib path to projectB, then tried to recompile all programs in it, but got errors.
     

  • How are you calling the second program?
    Does the first program perform a connect successfully and then use a CALL statement to call the second program as a .dll or is some other method being used?

    If I am not mistaken I believe your application has a VB front end, is that correct?
    Is program 2 being called from COBOL or from VB?
    Is there a second connect statement in program 2?

    What errors are you getting when you add litlink to the project B?

  • Don't know if it matters, but the call convention for program1 in projectA is call-convention 3 winapi and the procedure division looks like:

    procedure division WINAPI.

    entry 'MMMMMMM' using issue-linkage.

    It is usually called by VB, but I am just reassigning linkage and running it from COBOL.  It does a successful connect, then calls Program2 from projectB, in COBOL, (call c-xxxx-program using xxxx-linkage).  Program2 does not connect, but has various sql functions in it.

    error examples when I put litlink and/or oracle lib in projectb and rebuild for debug:

    Litlink

      * CSQL-I-018: Invoking Oracle Precompiler/Translator

    1>  * CSQL-I-020: Processing output of Oracle Precompiler

    1>  * CSQL-I-001: Cobsql has finished returning to the Checker

    1>  * Generating C:obj\x86\Debug\INSPECTR

    1>  * Data:       11120     Code:       22776     Literals:        6828

    1>     Creating library obj\x86\Debug\INSPECTR.lib and object obj\x86\Debug\INSPECTR.exp

    1>INSPECTR.obj (1,1-1) : error LNK2001 : unresolved external symbol _SQLADR

    1>INSPECTR.obj (1,1-1) : error LNK2001 : unresolved external symbol _SQLBEX

    1>INSPECTR.obj (1,1-1) : error LNK2001 : unresolved external symbol _CSQLSUPP

     

    Litlink and oracle lib

    1>  * Cobsql Integrated Preprocessor

    1>  * Compiling C:\MPIUA_DEV\artf363659\getuserp.pco

    1>  * CSQL-I-018: Invoking Oracle Precompiler/Translator

    1>  * CSQL-I-020: Processing output of Oracle Precompiler

    1>  * CSQL-I-001: Cobsql has finished returning to the Checker

    1>  * Generating C:obj\x86\Debug\getuserp

    1>  * Data:        2192     Code:        1232     Literals:         452

    1>     Creating library obj\x86\Debug\getuserp.lib and object obj\x86\Debug\getuserp.exp

    1>getuserp.obj (1,1-1) : error LNK2001 : unresolved external symbol _GetProfilesDirectoryA@8

    1>getuserp.obj (1,1-1) : error LNK2001 : unresolved external symbol _csqlsupp

    1>obj\x86\Debug\getuserp.dll : fatal error LNK1120: 2 unresolved externals

    1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Micro Focus\Visual COBOL\v1.0\MicroFocus.COBOL.CurrentVersion.targets(371,9): error : Compilation cancelled by user

    1>  COBOL compile: 2 item(s) succeeded or up-to-date, 7 failed.

     

     

     

     

     

     

  • Use LITLINK and try adding the following two libraries to the Link with Libs tab along with the orasql18.lib for the subprogram's project:

    csqlsupp.lib Userenv.lib

    This should take care of the two unresolved externals.

  • Hi!
    Unfortunately I am now getting 'LINK : fatal error LNK1181: cannot open input file 'userenv.lib' - I tried Userenv.lib - same results.
    Thing is, the project I am adding this to (projectB) is really our big project, and Kris told me she has not had to use any of this to get it to work, whereas another developer and I have to put LITLINK in even to get a connection to work. Could there be a setup or install difference? Thanks.
  • Verified Answer

    It sounds like perhaps you don't have the C Workload installed into Visual Studio and perhaps Kris does?

    I can get this to work without using LITLINK or specifying any libraries on the link tab in either project by simply placing the following in the main program:

    01 pp procedure-pointer.

    set pp to entry "orasql19.dll"

    I am using Oracle 19, you would set it to "orasql18.dll" in your case.

    Can you try this and tell me what the results are?

    Remove the LITLINK directive from both.

  • That worked!  Thank you, Chris!  I am not quite sure I understand why it works, but it does!