From: Graham Hobbs on
Hello,

I have a Windows XP script called abc.cmd running in a CMD window
containing:

cls
call stepp01 %1 %2 %3 %4
call drumaprep
call drumb %2
call drumc %1 %3 %4
...etc

It is called by running:

c:\>abc clna cpybk01 vsam 24

Upon invocation abc assigns the four parm values to %1 %2 %3 %4.
Stepp01 is an IBM Cobol program that via Linkage Section validates
these parms but finds that 'vsam' should be 'db2'.

Question is:
How do I change the value of %3 from vsam to db2 during the CMD
execution so when drumc is called it gets the right info?
Is there a 'standard'?

Please, thanks
Graham Hobbs
From: Binyamin Dissen on
On Mon, 01 Feb 2010 13:34:33 -0500 Graham Hobbs <ghobbs(a)cdpwise.net> wrote:

:>I have a Windows XP script called abc.cmd running in a CMD window
:>containing:

:>cls
:>call stepp01 %1 %2 %3 %4
:>call drumaprep
:>call drumb %2
:>call drumc %1 %3 %4
:>..etc

:>It is called by running:

:>c:\>abc clna cpybk01 vsam 24

:>Upon invocation abc assigns the four parm values to %1 %2 %3 %4.
:>Stepp01 is an IBM Cobol program that via Linkage Section validates
:>these parms but finds that 'vsam' should be 'db2'.

:>Question is:
:>How do I change the value of %3 from vsam to db2 during the CMD
:>execution so when drumc is called it gets the right info?
:>Is there a 'standard'?

Don't.

If STEPP01 determines the type, it should just set a variable and that
variable should be used in the script. You can also use the exit code.

--
Binyamin Dissen <bdissen(a)dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.
From: Graham Hobbs on
On Mon, 01 Feb 2010 22:27:35 +0200, Binyamin Dissen
<postingid(a)dissensoftware.com> wrote:

>On Mon, 01 Feb 2010 13:34:33 -0500 Graham Hobbs <ghobbs(a)cdpwise.net> wrote:
>
>:>I have a Windows XP script called abc.cmd running in a CMD window
>:>containing:
>
>:>cls
>:>call stepp01 %1 %2 %3 %4
>:>call drumaprep
>:>call drumb %2
>:>call drumc %1 %3 %4
>:>..etc
>
>:>It is called by running:
>
>:>c:\>abc clna cpybk01 vsam 24
>
>:>Upon invocation abc assigns the four parm values to %1 %2 %3 %4.
>:>Stepp01 is an IBM Cobol program that via Linkage Section validates
>:>these parms but finds that 'vsam' should be 'db2'.
>
>:>Question is:
>:>How do I change the value of %3 from vsam to db2 during the CMD
>:>execution so when drumc is called it gets the right info?
>:>Is there a 'standard'?
>

Benjamin, thanks for your comments:-)

>Don't.

Why don't?
Do you know if it can be done?

>
>If STEPP01 determines the type, it should just set a variable and that
>variable should be used in the script. You can also use the exit code.

In Cobol I can set RETURN-CODE to a value and test it via errorlevel.

Also I can set a variable to DB2 in STEPP01 but how do I pass that
variable to my CMD environment. I thought Cobol's only skill in
returning stuff to a CMD window was the RETURN-CODE - yes/no?

Cheers
Graham
From: Richard on
On Feb 2, 2:55 pm, Graham Hobbs <gho...(a)cdpwise.net> wrote:
> On Mon, 01 Feb 2010 22:27:35 +0200, Binyamin Dissen
>
>
>
> <postin...(a)dissensoftware.com> wrote:
> >On Mon, 01 Feb 2010 13:34:33 -0500 Graham Hobbs <gho...(a)cdpwise.net> wrote:
>
> >:>I have a Windows XP script called abc.cmd running in a CMD window
> >:>containing:
>
> >:>cls
> >:>call stepp01 %1 %2 %3 %4
> >:>call drumaprep
> >:>call drumb %2
> >:>call drumc %1 %3 %4
> >:>..etc
>
> >:>It is called by running:
>
> >:>c:\>abc clna cpybk01 vsam 24
>
> >:>Upon invocation abc assigns the four parm values to %1 %2 %3 %4.
> >:>Stepp01 is an IBM Cobol program that via Linkage Section validates
> >:>these parms but finds that 'vsam' should be 'db2'.
>
> >:>Question is:
> >:>How do I change the value of %3 from vsam to db2 during the CMD
> >:>execution so when drumc is called it gets the right info?
> >:>Is there a 'standard'?
>
> Benjamin, thanks for your comments:-)
>
> >Don't.
>
> Why don't?
> Do you know if it can be done?
>
>
>
> >If STEPP01 determines the type, it should just set a variable and that
> >variable should be used in the script. You can also use the exit code.
>
> In Cobol I can set RETURN-CODE to a value and test it via errorlevel.
>
> Also I can set a variable to DB2 in STEPP01 but how do I pass that
> variable to my CMD environment. I thought Cobol's only skill in
> returning stuff to a CMD window was the RETURN-CODE - yes/no?
>

When you execute a program (or CALL) you create a new child shell with
the environment copied from the parent. Changing the environment in
the child has no effect on the parent so when the CALL returns the
environment (and all the %x) is as it was before.

http://stackoverflow.com/questions/774047/how-can-i-change-windows-shell-cmd-exe-environment-variables-from-c


From: Binyamin Dissen on
On Mon, 1 Feb 2010 18:59:49 -0800 (PST) Richard <riplin(a)Azonic.co.nz> wrote:

:>On Feb 2, 2:55�pm, Graham Hobbs <gho...(a)cdpwise.net> wrote:
:>> On Mon, 01 Feb 2010 22:27:35 +0200, Binyamin Dissen

:>> <postin...(a)dissensoftware.com> wrote:
:>> >On Mon, 01 Feb 2010 13:34:33 -0500 Graham Hobbs <gho...(a)cdpwise.net> wrote:

:>> >:>I have a Windows XP script called abc.cmd running in a CMD window
:>> >:>containing:

:>> >:>cls
:>> >:>call stepp01 %1 %2 %3 %4
:>> >:>call drumaprep
:>> >:>call drumb %2
:>> >:>call drumc %1 %3 %4
:>> >:>..etc

:>> >:>It is called by running:

:>> >:>c:\>abc clna cpybk01 vsam 24

:>> >:>Upon invocation abc assigns the four parm values to %1 %2 %3 %4.
:>> >:>Stepp01 is an IBM Cobol program that via Linkage Section validates
:>> >:>these parms but finds that 'vsam' should be 'db2'.

:>> >:>Question is:
:>> >:>How do I change the value of %3 from vsam to db2 during the CMD
:>> >:>execution so when drumc is called it gets the right info?
:>> >:>Is there a 'standard'?

:>> Benjamin, thanks for your comments:-)

:>> >Don't.

:>> Why don't?
:>> Do you know if it can be done?

Because it is unclean, even if possible. Only change names variables.

:>> >If STEPP01 determines the type, it should just set a variable and that
:>> >variable should be used in the script. You can also use the exit code.

:>> In Cobol I can set RETURN-CODE to a value and test it via errorlevel.

That looks like the approach. Set a named variable to a value based on the
errorlevel.

:>> Also I can set a variable to DB2 in STEPP01 but how do I pass that
:>> variable to my CMD environment. I thought Cobol's only skill in
:>> returning stuff to a CMD window was the RETURN-CODE - yes/no?

:>When you execute a program (or CALL) you create a new child shell with
:>the environment copied from the parent. Changing the environment in
:>the child has no effect on the parent so when the CALL returns the
:>environment (and all the %x) is as it was before.

:>http://stackoverflow.com/questions/774047/how-can-i-change-windows-shell-cmd-exe-environment-variables-from-c

Didn't realize that Window$ didn't give an API to set a variable in the
calling process.

--
Binyamin Dissen <bdissen(a)dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.