Highlighted
Absent Member.
Absent Member.
550 views

[archive] Calling a pgm with SWITCH-1 = ON

[Migrated content. Thread originally posted on 02 April 2005]

We have a need to call a child pgm, and pass a Special-Names SWITCH-1 status.

The 6.1 documentation shows the call stmnt as CALL "CHILD/A" where the /A is supposed to set-on the SWITCH-1 defined in the CHILD pgm.

We keep getting a runtime err = Pgm CHILD/A not found. It seems the runtime doesn't like the /A, and I've tried (blank)/A, -A in the CALL sequence inside the quotes and all options get the same err.

Has the calling syntax changed for this type of CALL, or is this type of CALL capability "broken" ?

Anyone got a suggestion as to how to call another pgm and pass it a SWITCH status other than the regular Linkage Section?

Thanks, ed...
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a pgm with SWITCH-1 = ON

I have not tried that method (with the /A in the CALL) with Acucobol. Back in the old days with DG ICOBOL, you could do that with the CALL PROGRAM verb, but not with CALL.

Here is how we do it now:

Program PARENT:

SPECIAL-NAMES.
SWITCH "A" IS SWA.
..
PROCEDURE DIVISION.
..
SET SWA TO ON.
CALL "CHILD".

When CHILD is run, switch "A" (SWITCH-1) will be on because the program inherits the switches from the parent.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a pgm with SWITCH-1 = ON

I just took a look at the Acucobol docs. It shows that the "/A" would only work with the CALL PROGRAM verb, not CALL.

Note that CALL PROGRAM is different than CALL. A program that is called using CALL PROGRAM cannot return to the caller. It is more like the CHAIN verb.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a pgm with SWITCH-1 = ON

We use the CALL PROGRAM and SW1 syntax here.

You do have to use CALL PROGRAM instead of just CALL. The call program actually acts like a CANCEL ALL, then starts the program. I was told years ago by an Acucorp developer that it restarts a new 'instance' of the runtime, (which may no longer be true).

One thing I would warn you about, if program A does
CALL PROGRAM "X/A"

and program X does
CALL "Y"

then SW1 is on in Y also. Found that out by mistake!
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Calling a pgm with SWITCH-1 = ON

Sorry for the late post.

Have you tried the format 4 of the 'SET' statement?

This is supposed to let you do something like the following:

SET SWITCH-1 TO ON.

and then you can CALL your sub-program.

I haven't tried it myself, but the docs say it can be done.

Good luck.
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.