For Programmers: Free Programming Magazines  


Home > Archive > Cobol > January 2006 > cobol called program not refreshed









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cobol called program not refreshed
freelance

2006-01-19, 3:55 am

I have 2 cobol (batch) programs

-> the FATHER:
MOVE 'A' TO FOO1.
MOVE 'B' TO FOO2.
CALL 'SON' USING FOO1 FOO2.
CANCEL 'SON'.
MOVE 'X' TO FOO1.
CALL 'SON' USING FOO1.
CANCEL 'SON'.

->the SON:
PROGRAM-ID. SON INITIAL.
PROCEDURE DIVISION USING FOO1 FOO2.
DISPLAY ' FOOs ' FOO1 FOO2.
GOBACK .

the output looks like:

FOOs A B
FOOs X B

Looks like 'SON' is loaded only the first time and never refreshed
despite the 'INITIAL' and 'CANCEL'.

Any hint ? suggestion ? directions ?

TIA
:-)

VSE 2.6.2
COBOL FOR VSE/ESA 1.1.1

Rick Smith

2006-01-19, 3:55 am


"freelance" <rfacco@email.it> wrote in message
news:1137659256.927086.102740@o13g2000cwo.googlegroups.com...
[snip]
> ->the SON:
> PROGRAM-ID. SON INITIAL.
> PROCEDURE DIVISION USING FOO1 FOO2.

if address of foo2 = null
display 'FOOs' foo1 space
else
> DISPLAY ' FOOs ' FOO1 FOO2 [remove the '.']

end-if
> GOBACK .

[snip]
> VSE 2.6.2
> COBOL FOR VSE/ESA 1.1.1


The ADDRESS OF special register appers to have been
added with VS COBOL II, so it should be available for
your use; but I do not work with IBM mainframes.



William M. Klein

2006-01-19, 3:55 am

Which compiler option are you using DYNAM or NODYNAM?

I thought that the "IS INITIAL" took precedence over this, but at least with MVS
(not VSE) a CANCEL statement is IGNORED for load modules compiled with the
NODYNAM compiler option. (This is documented. Check your documentation for
CANCEL and NODYNAM)

--
Bill Klein
wmklein <at> ix.netcom.com
"freelance" <rfacco@email.it> wrote in message
news:1137659256.927086.102740@o13g2000cwo.googlegroups.com...
>I have 2 cobol (batch) programs
>
> -> the FATHER:
> MOVE 'A' TO FOO1.
> MOVE 'B' TO FOO2.
> CALL 'SON' USING FOO1 FOO2.
> CANCEL 'SON'.
> MOVE 'X' TO FOO1.
> CALL 'SON' USING FOO1.
> CANCEL 'SON'.
>
> ->the SON:
> PROGRAM-ID. SON INITIAL.
> PROCEDURE DIVISION USING FOO1 FOO2.
> DISPLAY ' FOOs ' FOO1 FOO2.
> GOBACK .
>
> the output looks like:
>
> FOOs A B
> FOOs X B
>
> Looks like 'SON' is loaded only the first time and never refreshed
> despite the 'INITIAL' and 'CANCEL'.
>
> Any hint ? suggestion ? directions ?
>
> TIA
> :-)
>
> VSE 2.6.2
> COBOL FOR VSE/ESA 1.1.1
>



William M. Klein

2006-01-19, 7:55 am

Ignore my last note.

In your 2nd CALL statement, you only pass 1 parameter, however you reference
both Linkage Section items in the subprogram after this CALL.

In this case, "results are unpredictable" - regardless of CANCEL, IS INITIAL, or
anything else. IBM "chooses" to leave addressability to whatever was there
"before" - but the Standard just says that anything can happen.

If you happen to be familiar (or others who read this who use the Micro Focus
compiler) this is the origin of the
STICKY-LINKAGE
directive.

IS INITIAL and CANCEL are *not* required to "refresh" a subprogram, only to
place it in "initial state". The state of Linkage Section items is undefined in
"initial state".

If you want to "refresh" addressability to linkage section items, you MIGHT be
able to do a

Set Address of Foo2 to Nulls
before the GoBack in the SON program.

Of course, what this would do would be to give you "garbage" on the 2nd Display
(or at least it might).

P.S. I was partially because you didn't show us the Linkage Section of
the SON program.

P.P.S. Another common misconception is that CANCEL "free storage". Again, it
MAY do this (and some, not all implementations do this), but all it is REQUIRED
to do is to place the subprogram in "initial state".

--
Bill Klein
wmklein <at> ix.netcom.com
"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:uiJzf.46401$mP4.23219@fe05.news.easynews.com...
> Which compiler option are you using DYNAM or NODYNAM?
>
> I thought that the "IS INITIAL" took precedence over this, but at least with
> MVS (not VSE) a CANCEL statement is IGNORED for load modules compiled with the
> NODYNAM compiler option. (This is documented. Check your documentation for
> CANCEL and NODYNAM)
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "freelance" <rfacco@email.it> wrote in message
> news:1137659256.927086.102740@o13g2000cwo.googlegroups.com...
>
>



Pete Dashwood

2006-01-19, 7:55 am

In the second call you are not passing the full parameter list. "Results are
unpredictable" in IBM environments when you do this.

CANCEL doesn't always remove your subprogram from storage and INITIAL only
guarantees local storage when the called program is invoked correctly.

Pete.

TOP POST
"freelance" <rfacco@email.it> wrote in message
news:1137659256.927086.102740@o13g2000cwo.googlegroups.com...
>I have 2 cobol (batch) programs
>
> -> the FATHER:
> MOVE 'A' TO FOO1.
> MOVE 'B' TO FOO2.
> CALL 'SON' USING FOO1 FOO2.
> CANCEL 'SON'.
> MOVE 'X' TO FOO1.
> CALL 'SON' USING FOO1.
> CANCEL 'SON'.
>
> ->the SON:
> PROGRAM-ID. SON INITIAL.
> PROCEDURE DIVISION USING FOO1 FOO2.
> DISPLAY ' FOOs ' FOO1 FOO2.
> GOBACK .
>
> the output looks like:
>
> FOOs A B
> FOOs X B
>
> Looks like 'SON' is loaded only the first time and never refreshed
> despite the 'INITIAL' and 'CANCEL'.
>
> Any hint ? suggestion ? directions ?
>
> TIA
> :-)
>
> VSE 2.6.2
> COBOL FOR VSE/ESA 1.1.1
>



Pete Dashwood

2006-01-19, 7:55 am

As usual, an accurate and useful response, Bill. :-)

I should have read the whole thread before replying above...

Pete.

"William M. Klein" <wmklein@nospam.netcom.com> wrote in message
news:UFJzf.9238$Xg2.5453@fe01.news.easynews.com...
> Ignore my last note.
>
> In your 2nd CALL statement, you only pass 1 parameter, however you
> reference both Linkage Section items in the subprogram after this CALL.
>
> In this case, "results are unpredictable" - regardless of CANCEL, IS
> INITIAL, or anything else. IBM "chooses" to leave addressability to
> whatever was there "before" - but the Standard just says that anything can
> happen.
>
> If you happen to be familiar (or others who read this who use the Micro
> Focus compiler) this is the origin of the
> STICKY-LINKAGE
> directive.
>
> IS INITIAL and CANCEL are *not* required to "refresh" a subprogram, only
> to place it in "initial state". The state of Linkage Section items is
> undefined in "initial state".
>
> If you want to "refresh" addressability to linkage section items, you
> MIGHT be able to do a
>
> Set Address of Foo2 to Nulls
> before the GoBack in the SON program.
>
> Of course, what this would do would be to give you "garbage" on the 2nd
> Display (or at least it might).
>
> P.S. I was partially because you didn't show us the Linkage
> Section of the SON program.
>
> P.P.S. Another common misconception is that CANCEL "free storage". Again,
> it MAY do this (and some, not all implementations do this), but all it is
> REQUIRED to do is to place the subprogram in "initial state".
>
> --
> Bill Klein
> wmklein <at> ix.netcom.com
> "William M. Klein" <wmklein@nospam.netcom.com> wrote in message
> news:uiJzf.46401$mP4.23219@fe05.news.easynews.com...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com