View previous topic :: View next topic
|
Author |
Message |
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
Hi All
Could you please help to understand what value will be in progA after the call to Progb
Code: |
ProgA
working storage.
ws-ptr pointer.
linkage section.
01 abc
05 header value 'ABC'
05 abc-ptr pointer.
05 def-ptr pointer.
05 hij-ptr pointer.
01 xyz
05 xyz1 pic x(10)
05 xyz2 pic x(10)
procedure division
CALL progB DFHEIBLK
ws-ptr
set address of abc to ws-ptr
set address of xyz to abc-ptr.
ProgB
linkage section.
01 dfhcommarea.
05 proga-ptr pointer.
01 abc
05 header value 'ABC'
05 abc-ptr pointer.
05 def-ptr pointer.
05 hij-ptr pointer.
procedure division using dfhcommarea.
set address of abc to proga-ptr
call progc using dfheiblk
abc-ptr. ***progc is getting some address in abc-ptr****
exec cics write TSQ TS Queue(q1)
from(proga-ptr)
end-exec
|
I was just wondering what will be the output address of this code |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have to show the CALL and PROCEDURE DIVISION USING from the compile output listing, as progB at least hase been compiled as a CICS program. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
since proga will not compile and even if progb compiles, it will have a run time error.
what the TS should do is spend some time reading
the COBOL Programmers' guide
and the reference,
both of which do an excellent job of explaining pointers.
then he TS should spend some time programming and testing,
THEN return to the forum with his questions.
we are not tutors, we answer specific questions.
the garbage presented as an example indicate that the TS
requires basic knowledge. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
as a final note.
cobol pointers (used to contain addresses) are no different in CICS than in a batch environment,
other than the exception that the areas to which they point should not exceed 4K for earlier releases of CICS. |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
as these are supposed to CICS program the TS should be using LINK and not CALL |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Adding to Mickey's post, CALL's can only be issued as Local (confined to the local region).
However, issuing a LINK-API, passing a pointer in a commarea (not recommended by IBM), could backfire if suddenly, the target program is no longer Local and is now defined as Remote in the PPT entry (parameter REMOTESYSTEM is non-space) or some bonehead has added the SYSID keyword to the API.
Attempting to establish addressability to storage in a Remote region via a pointer in the commarea won't work and could cause many problems.
Mr. Bill |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
Good point Bill, as I assumed the TS is trying to attempt this in the same CICS region... Shame on me |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I was thinking TS is taking it from a "working" system and wanting to understand what value ends up where, having foolishly typed out a shortened version of what they feel is relevant, rather than pasting from the screen. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Perhaps he fails to understand that a CALL passes the address of the storage of a given parameter (won't go into Assembler geekiness breakdown).
I see no purpose in passing a pointer in this CALL example.
Mr. Bill |
|
Back to top |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
also what is the pointer suppose to be point to.???? and why are you using a pointer for this purpose..???? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
in cics, as well as in batch,
(thus requiring the methodology to be used only in local CICS regions and never with remote)
passing a GROUP (defined with copybook) which contains a list of pointers
allows one to pass many structures, yet having only one parameter in the CALL USING list,
thus allowing for a common CALL in all modules.
example:
you have a CALL chain of potentially 10 modules.
the high level initiator of the CALL chain can pass, say, 15 structures,
yet have only one parm in the CALL USING list.
each of the 10 modules in the chain can then address any of the 15 structures.
if a new module is added to the CALL chain,
and it requires yet a new structure,
only the - copybook changed to add the new pointer
- high level module changed to add
- the new structure in WORKING-STORAGE
- SET the new pointer to address of new structure
- the module initiating the new CALL changed by adding the new CALL
and all 10 modules recompiled, without having the need to change the parameter list in the common CALL USING list
this methodology is often employed with COBOL modules that are used by both batch and CICS
and obviously not using the outdated DFH parms and forcing a CICS precompile for modules that invoke no CICS API's. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, you do not have to recompile the modules that do not address the added (at the end of the group structure) element of the group structure (new pointer).
you only have to
recompile the - high level module
- module making new CALL
and compile the newly CALLed module
using pointers has the
advantage over extended CALL USING lists in that intervening modules must not be recompiled
but has the disadvantage of requiring all your programmers to understand pointers. |
|
Back to top |
|
|
akodakka
New User
Joined: 20 May 2010 Posts: 75 Location: India
|
|
|
|
hi dbzTHEdinosauer
Yes this is what exactly am doing.
Thanks' |
|
Back to top |
|
|
|