Highlighted
Absent Member.
Absent Member.
2682 views

Problem with CALL command and environment variables

Jump to solution

[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
0 Likes
1 Solution

Accepted Solutions
Highlighted
Absent Member.
Absent Member.

RE: Problem with CALL command and environment variables

Jump to solution
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


View solution in original post

0 Likes
5 Replies
Highlighted
Micro Focus Contributor
Micro Focus Contributor

RE: Problem with CALL command and environment variables

Jump to solution
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?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Problem with CALL command and environment variables

Jump to solution
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
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Problem with CALL command and environment variables

Jump to solution
sorry...

the content of VC_CFG.sh is

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

Thank you
0 Likes
Highlighted
Micro Focus Contributor
Micro Focus Contributor

RE: Problem with CALL command and environment variables

Jump to solution
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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Problem with CALL command and environment variables

Jump to solution
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


View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.