Skip to main content

CALL "SYSTEM" USING WS-COMMAND-LINE.

  • March 31, 2016
  • 3 replies
  • 1 view

Alberto Ferraz

Hello:

In NetExpress i use a command "CALL "SYSTEM" USING command-line" where command-line is a call to a batch file

"cmd /C hash.bat 001181107".

I copied the routine for Visual Cobol but I think the command is not running as the result of the CALL does not appear.
Is there any other way to do this command?

Thanks

Alberto Ferraz

3 replies

Hello:

In NetExpress i use a command "CALL "SYSTEM" USING command-line" where command-line is a call to a batch file

"cmd /C hash.bat 001181107".

I copied the routine for Visual Cobol but I think the command is not running as the result of the CALL does not appear.
Is there any other way to do this command?

Thanks

Alberto Ferraz

Hi Alberto,

Make sure you null terminate your command. This works OK for me:-

      identification division.

      program-id. Program1.

      environment division.

      configuration section.

      data division.

      working-storage section.

      procedure division.

          call "system" using z"dir c:\\|more"

          goback.

You can also use the X"91" Function 35 call to do this:-

documentation.microfocus.com/.../index.jsp;cp=5_5_3_9_30_6

or go to a Windows API (CreateProcess).

Regards

David


Chris Glazier
Forum|alt.badge.img+2

Hello:

In NetExpress i use a command "CALL "SYSTEM" USING command-line" where command-line is a call to a batch file

"cmd /C hash.bat 001181107".

I copied the routine for Visual Cobol but I think the command is not running as the result of the CALL does not appear.
Is there any other way to do this command?

Thanks

Alberto Ferraz

Alberto,

Also please be aware that in Net Express when running from within the IDE the current directory was set as the project directory by default so your .bat file would be found if located there.

In Visual COBOL when running from within the IDE the currently directory is set at the Output directory by default. This is the folder in which your compiled executable files would be placed, i.e proj\\bin\\x86\\debug in Visual Studio.

With your command if the .bat file is not in the current directory it will not be found.

Thanks


Alberto Ferraz
  • Author
  • Participating Frequently
  • March 31, 2016

Hello:

In NetExpress i use a command "CALL "SYSTEM" USING command-line" where command-line is a call to a batch file

"cmd /C hash.bat 001181107".

I copied the routine for Visual Cobol but I think the command is not running as the result of the CALL does not appear.
Is there any other way to do this command?

Thanks

Alberto Ferraz

Hello david and Chris:

Have redefined the path and the call is already running.

The BAT.FILE is already being called by Cobol.

Thanks again for your help.

Best Regards

Alberto Ferraz