Need to issue a DOS command from within a native COBOL program

In my COBOL program I would construct a DOS command like "copy EDITFILE.txt EDITFILE-Finance.txt"

Question:  how can I cause the COBOL program to actually issue that command?

Parents
  • One little correction to ensure it is future proof..

    Remember to zero terminate the argument, either via the use of z" " or add a x"0" to the end of the pic x field.

    eg:

    CALL "SYSTEM" USING z"CMD.EXE /C COPY /Y EDITFILE.txt EDITFILE-Finance.txt".

    02 COPY-D PIC X (33) z"EDITFILE.txt EDITFILE-Finance.txt".
    CALL "SYSTEM" USING COPY-D.

Reply
  • One little correction to ensure it is future proof..

    Remember to zero terminate the argument, either via the use of z" " or add a x"0" to the end of the pic x field.

    eg:

    CALL "SYSTEM" USING z"CMD.EXE /C COPY /Y EDITFILE.txt EDITFILE-Finance.txt".

    02 COPY-D PIC X (33) z"EDITFILE.txt EDITFILE-Finance.txt".
    CALL "SYSTEM" USING COPY-D.

Children
No Data