Highlighted
Absent Member.
Absent Member.
316 views

[archive] batch accept

[Migrated content. Thread originally posted on 12 September 2008]

I'd like to have a bat file that runs a simple batch program but the program accepts parameters at run time from the bat file. Please forgive me but in what I'm used to, some JCL could be written with the following:

run prog1
Y
N
end job

PROG1 starts, it sends a display/accept for parm 1 and gets back a 'Y' and then sends a display/accept for parm 2 and gets back an 'N'.

If the bat file contains the following, how do you get PROG1 to accept the run parameters. Adding the 2 parms under the bat file statement won't work. Can the run statement include something like "accept Y,N at start"

C:\acucobol\object\PROG1.acu
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

Display statements are really not a good idea for true batch jobs. With Extend a display statement tries to create a window on the terminal / console and in the case of a batch job you do not want this to occur.

Have the program accept values from environment variables and then set the environment variables in your batch script.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

I'm new to this arena, can you provide an example?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

@echo off
set my-var=my-val
wrun32.exe Program1

You can adding pathing to this example, name it as a xxx.bat file and then lauch it from a command window.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

Like I said, I'm new to this arena.
How does program1 get the value that's been 'set'
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

Working-Storage Section.
01 my-val pic x(20).

Procedure Division.

accept my-val from environment "my-val".

perform process-my-val-routine.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] batch accept

Success !
Thank you
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.