Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am using a cobol program to issue 1

Status
Not open for further replies.

krickb

Programmer
Nov 19, 2003
11
US
Hi everyone,
I am having a problem with a cobol program issuing commands to Unix.

Here are the commands in the cobol program:

CALL "SYSTEM" USING 'cp /mydir/MYFILE1 MYFILE2'
CALL "SYSTEM" USING 'lp -d myprinter_2 /mydir/FILE.TXT'

The cobol program then returns this error:


lp: can't access file "/mydir/FILE.TXTydir/MYFILE2'"


This indicates to me that the first CALL to "SYSTEM"
is being concatentated with the second CALL to "SYSTEM'.
Is there a way to clear the first CALL after it has been performed?
Thanks for any suggestions.
KRICKB

 
Never seen this before and used system calls quite a lot.
1. Add a CANCEL "SYSTEM" after each of the calls.
2. Use a Working storage variable instead of the string at the end of the call, thus ensuring it will be cleared down.

Hammy.
 
Hi,

Try to put a low-value at the end of the parm. I guess the system looks for an ASCII-Z token or so. Use a working-storage variable:

01 SYSTEM-PARM.
03 SYSTEM-PARM-COMMAND PIC X(255).
03 SYSTEM-PARM-ASCII-Z PIC X VALUE LOW-VALUE.

Move the command to SYSTEM-PARM-COMMAND and do the call like:

MOVE "cp /mydir/MYFILE1 MYFILE2" TO SYSTEM-PARM-COMMAND.
CALL "SYSTEM" USING SYSTEM-PARM.
MOVE "lp -d myprinter_2 /mydir/FILE.TXT" TO SYSTEM-PARM-COMMAND.
CALL "SYSTEM" USING SYSTEM-PARM.

Regards,

Crox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top