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?
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.
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.
The uppercase SYSTEM library api is a wrapper to the lowercase 'C' system api.
This uppercase wrapper version of the api ensure the terminal is setup before proceeding to the lowercase system api.
The parameters to the api are passed through without being changed. The 'C' system api takes a zero terminated string aka a "char *".
The one exception being is you are compiling for ACU compatibility directives, an alternative SYSTEM library api is used, which does not require the parameter to be zero terminated.
Both have the same name but expect the parameter to be different.