Skip to main content

I am trying to run a program with a batch file.  The program I am trying to run has parameters.  How do we pass parameters from an Batch File in Visual COBOL?

In RM\\COBOL you do it this way: -A="P"

The command in my batch file to run the program currently is:

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM

I am trying to run a program with a batch file.  The program I am trying to run has parameters.  How do we pass parameters from an Batch File in Visual COBOL?

In RM\\COBOL you do it this way: -A="P"

The command in my batch file to run the program currently is:

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM

The easiest method is to just do the following:

01 ws-command-line pic x(100) value spaces.
procedure division.

   accept ws-command-line from command-line
   

This will place the entire command-line into ws-command-line. 


The easiest method is to just do the following:

01 ws-command-line pic x(100) value spaces.
procedure division.

   accept ws-command-line from command-line
   

This will place the entire command-line into ws-command-line. 

But what do I put in my Batch file to pass the parameter to the COBOL program?


But what do I put in my Batch file to pass the parameter to the COBOL program?

Exactly what you posted:

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM

ws-command-line will then contain UBMGHPGM


Exactly what you posted:

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM

ws-command-line will then contain UBMGHPGM

I don't think you understand what I am asking.  The COBOL program name is UBMGHPGM.  It has a one character parameter, either O, U, P, or R.  I need to pass this parameter into UBMGHPGM in order for it to run the correct code within the program.

RUNCONSOLE.EXE allows me to run the UBMGHPGM program stand alone from my project.


I don't think you understand what I am asking.  The COBOL program name is UBMGHPGM.  It has a one character parameter, either O, U, P, or R.  I need to pass this parameter into UBMGHPGM in order for it to run the correct code within the program.

RUNCONSOLE.EXE allows me to run the UBMGHPGM program stand alone from my project.

Yes, you are correct I did not understand. I do not know anything about msirunconsole so do not know how it starts up the program whose name is being passed to it. If it is starting the program using something like createprocess then you might try to pass the param after the program name.

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM A


Yes, you are correct I did not understand. I do not know anything about msirunconsole so do not know how it starts up the program whose name is being passed to it. If it is starting the program using something like createprocess then you might try to pass the param after the program name.

"D:\\msi-plus\\MSI_PLUS\\MSIRUNCONSOLE.exe" UBMGHPGM A

There was a COBOL program that I had to modify in the MSIRUNCONSOLE project -but I got it working now! Thanks for your help!