Problem with CALL command and environment variables

[Migrated content. Thread originally posted on 13 December 2011]

I have a remote project “Program3” in a AIX system created with Visual Cobol Eclipse (Windows). This project contains a unique program that makes a CALL to “Program4.so”; and “Program4” only displays “Hello World! I’m Program4!!!”.

When I execute “Program3” from AIX system, I receive the error:

Load error : file 'Program4'                                                   
error code: 173, pc=0, call=1, seg=0                                           
173    Called program file not found in drive/directory


To solve this problem I had to initialize COBPATH with the “Program4.so” path.
But the problem is that it seems that the initialization of COBPATH does not work in certain cases:

1)“Program3” works correctly when COBPATH initialization is realized in command line

(DES):aixlab0102:/>export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS

or from “Program3” code ..

...
            SET ENVIRONMENT “COBPATH“ TO
            "/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS".
            ...


2)But If I have the “export” command "export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS"
in a script VC_CFG.sh, and I execute the script

            (DES):aixlab0102:/>. ./VC_CFG.sh

“Program3” returns the error again.


            Load error : file 'Program4'                                                   
            error code: 173, pc=0, call=1, seg=0                                           
            173    Called program file not found in drive/directory


I can understand it because if I do

                (DES):aixlab0102:/>echo $COBPATH

it displays "/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS".

And if I make a display of the variable from “Program3” code


                MOVE SPACES TO VAL.
                CALL "C$GetEnv" USING "COBPATH" VAL.
                CANCEL "C$GetEnv".         
                display "GetEnv COBPATH: ", VAL.


It displays "GetEnv COBPATH: /MNG/DESA/FICH/EQBASE/00550051/VC_OBJS"



Where can be the problem?

Thank you
  • When you start Program3
    1. What shell are you running it from? Bourne, Korn?
    2. Is Program3 a exe, or int?
    3. Are you starting with a relative path such as cobrun ./Program3 or are you absolute pathing it.
    4. What are the full contents of VC_CFG.sh? Is a hashpling specified? And is it a Bourne shell or a Korn shell?

    In your testcase 2, I infer that after running . ./VC_CFG.sh you can can echo $COBPATH and it display /MNG/DESA/FICH/EQBASE/00550051/VC_OBJS, but then fail to find Program4 after launching Program3 in the same manner as testcase 1. Is that understanding correct?
  • When you start Program3
    1. What shell are you running it from? Bourne, Korn?

    Korn shell

    2. Is Program3 a exe, or int?

    Program3 is a exe.

    3. Are you starting with a relative path such as cobrun ./Program3 or are you absolute pathing it.

    I execute Program3 as follows:
    (DES):aixlab0102:/MNG/DESA/FICH/EQBASE/00550051>./Program3
    4. What are the full contents of VC_CFG.sh? Is a hashpling specified? And is it a Bourne shell or a Korn shell?

    The content of VC_CFG.sh is
    export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJ

    In your testcase 2, I infer that after running . ./VC_CFG.sh you can can echo $COBPATH and it display /MNG/DESA/FICH/EQBASE/00550051/VC_OBJS, but then fail to find Program4 after launching Program3 in the same manner as testcase 1. Is that understanding correct?

    Yes it's the problem...


    Thank you
  • sorry...

    the content of VC_CFG.sh is

    export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS

    Thank you
  • sorry...

    the content of VC_CFG.sh is

    export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS

    Thank you
  • What happens:
    if you were to break up export command in the call script to:
    COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJS
    export COBPATH

    if you were to run Program3 in the call scipt right after the export command.
  • Verified Answer

    Hello,

    I have found the solution...

    The problem was that the script was in windows format; if I open the script with "vi"...

    export COBPATH=/MNG/DESA/FICH/EQBASE/00550051/VC_OBJ^M

    So I created a new script with "vi" command, with the same commands, and now the VisualCobol programs works correctly.


    Thanks for the help