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!

running shell script in a cobol program

Status
Not open for further replies.

chisox

Programmer
Sep 28, 2000
1
US
for example:
if I needed to execute 'cp filea filea.bak' in a COBOL
program what would be needed to do this.


Thankyou [sig][/sig]
 
Try this:

WORKING-STORAGE SECTION.
01 MY-RUN-COMMAND.
10 FILLER PIC X(3) VALUE "cp ".
10 MY-FROM-FILENAME PIC X(30).
10 FILLER PIC X VALUE " ".
10 MY-TO-FILENAME PIC X(30).
10 FILLER PIC X VALUE X"00".

PROCEDURE DIVISION.
MOVE "filea" TO MY-FROM-FILENAME.
MOVE "filea.bak" TO MY-TO-FILENAME.
CALL "SYSTEM" USING MY-RUN-COMMAND.

Good luck!
bill




[sig][/sig]
 
Hi !

Is this for copying one file from another? I could not follow the question.

Akondeti
[sig][/sig]
 
You should also check the return code

call "SYSTEM" USING MY-RUN-COMMAND RETURNING FOO

Then test the return code from the call to make sure things worked. [sig]<p> Glen Colbert<br><a href=mailto: gcolbert@RAG_American.com> gcolbert@RAG_American.com</a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top