Skip to main content

Hi, 

In MF COBOL Unix Environment , we used Call SYSTEM to execute Unix Commands from COBOL program.( Mostly used to move files )

In Visual COBOL on Windows ( Oracle DataBase and Powershell scripts ) , how will i execute above commands by using Call SYSTEM.

string 'move ' delimited by size 'D:\\DataFiles\\*'  delimited by size 'D:\\OutDataFiles' delimited by size X"00" delimited by size

           into WS-SHELL-CMD
end-string.

call 'system' using WS-SHELL-CMD.

We will be using Windows command prompt commands to execute instead of Unix commands ?

Please advise if there is something incorrect or missing.

Hi, 

In MF COBOL Unix Environment , we used Call SYSTEM to execute Unix Commands from COBOL program.( Mostly used to move files )

In Visual COBOL on Windows ( Oracle DataBase and Powershell scripts ) , how will i execute above commands by using Call SYSTEM.

string 'move ' delimited by size 'D:\\DataFiles\\*'  delimited by size 'D:\\OutDataFiles' delimited by size X"00" delimited by size

           into WS-SHELL-CMD
end-string.

call 'system' using WS-SHELL-CMD.

We will be using Windows command prompt commands to execute instead of Unix commands ?

Please advise if there is something incorrect or missing.

The call "system" is supported under Windows in the same manner as under Unix so the above command should work just fine.

If you wish to suppress the prompt o overwrite existing files then you can add the "/Y" switch to the move command.