Admiral
Admiral
2742 views

CALL "SYSTEM" USING WS-COMMAND-LINE.

Jump to solution

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

0 Likes
1 Solution

Accepted Solutions
Admiral
Admiral

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

View solution in original post

0 Likes
3 Replies
Absent Member.
Absent Member.

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

0 Likes
Micro Focus Expert
Micro Focus Expert

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

0 Likes
Admiral
Admiral

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

View solution in original post

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.