Skip to main content

This article identifies different behaviours of "call system” between UNIX environments.

Problem:

The user program makes a call to system, for example:
call “system” using “ls -la”
On one system this works as expected, whereas on another it is necessary to add x“00” to the end of the command-line. For example:
01 WORK-COMMAND.            03 COMMAND              PIC X(050) VALUE “ls -la”.            03 FILLER                    PIX X(002) VALUE X”00”.procedure division.CALL “SYSTEM” USING WORK-COMMAND.
Why is this?

Resolution:

This behaviour depends on the case used in the CALL statement.

call "system" (all lower-case) calls the OS system utility. This is platform specific, and may give unexpected terminal display results. When you are using the MF function CALL "SYSTEM" (upper-case) you must use x"00" to terminate the command.

Incident Number: 2202924

Date: Name: Description of change: Date: Name: Description of change: 
Old KB# 14206