Skip to main content
Question

return-code of call 'SYSTEM' using comando

  • April 15, 2026
  • 3 replies
  • 22 views

M Carmen De Paz
Forum|alt.badge.img+2

Hi , we are working with Microfocus Visual COBOL for Eclipse on Linux/UNIX V8.0 and we do a lot of call SYSTEM in a lot of programs .

We take the return-code of de call SYSTEM and we have detected that when we run in a SO LINUX if the execution is with newrun the return-code is 0 , but mis the execution is from a transational monitor writted in C the return-code is alwais 1

 

The same programs executed in AIX returns 0 

 

3 replies

Blair McDonald
Forum|alt.badge.img+1

Hi,

A few questions and ideas about your post:

  1. Is the call to SYSTEM failing when you get the return code 1? Or are you just receiving a bad return code even though the call actually works?
  2. You mentioned "we run in a SO LINUX". Are you talking about running COBOL built to a Shared Object (.so) on Linux, or did you mean something different?
  3. About your reference to using "newrun" in the working scenario. Is "newrun" a rebuilt version of the Micro Focus COBOL Runtime system? If so, can you share the command that was used to build the "newrun" runtime?
  4. You mentioned a behavior difference between AIX and Linux. Since these platforms are using different Endianism (bit order for binary fields) there is the possibility that the COBOL code that works on AIX (Big Endian) might not be written to work correctly on a Little Endian platform. This Knowledge Article shows an example of a COBOL program written to retrieve a return code from CALL "SYSTEM" regardless of platform - perhaps you can compare it to your code?

 

Thanks

Blair


M Carmen De Paz
Forum|alt.badge.img+2
  • Author
  • Participating Frequently
  • April 16, 2026

I respose your questions:

  1. The script the is cllaing by de call SYSTEM works Ok and de $? final is 0 but  the returnd-code recived in the cobol program is -1 .
  2. Now we are compiling and runing the cobol programs (.gnt) in a server AIX , and we are migrating to a server SUSE LINUX
  3. We have two ways to execute COBOL programs:
    - Batch, that is, by invoking the program with the COBRUN we have adapted and call `newrun`;
    - Online, that is, through a transaction monitor written in C that makes a COBRUN call to an initial program that is responsible for calling the rest using `call`.

In platform AIX the call SYSTEM works equal in the tow ways of execute a cabol program , but in LINUX if we execute de progarm i batch way it works fine, but if we execute de progranm in online way the return-code alwais is -1

 


Blair McDonald
Forum|alt.badge.img+1

Thank you for your update. Sometimes COBOL code that is not written to be portable can fail on a new platform. You might want to confirm that the CALL "SYSTEM" statement is coded as suggested in the Knowledge Article I linked before, and that the variables used on that statement are defined in a similar way - especially in regard to having the command string null terminated.