IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Pointer usage in CICS


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Fri Feb 24, 2012 3:36 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 24, 2012 4:04 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Feb 24, 2012 5:05 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Feb 24, 2012 5:26 am
Reply with quote

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
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Feb 24, 2012 10:12 pm
Reply with quote

as these are supposed to CICS program the TS should be using LINK and not CALL
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Feb 24, 2012 10:25 pm
Reply with quote

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
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Feb 24, 2012 10:28 pm
Reply with quote

Good point Bill, as I assumed the TS is trying to attempt this in the same CICS region... Shame on me
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Feb 24, 2012 10:58 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Feb 24, 2012 11:20 pm
Reply with quote

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). icon_wink.gif

I see no purpose in passing a pointer in this CALL example.

Mr. Bill
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Fri Feb 24, 2012 11:27 pm
Reply with quote

also what is the pointer suppose to be point to.???? and why are you using a pointer for this purpose..????
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Feb 25, 2012 2:35 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sat Feb 25, 2012 3:02 am
Reply with quote

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
View user's profile Send private message
akodakka

New User


Joined: 20 May 2010
Posts: 75
Location: India

PostPosted: Thu Mar 15, 2012 12:54 am
Reply with quote

hi dbzTHEdinosauer

Yes this is what exactly am doing.

Thanks'
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts Calling an Open C library function in... CICS 1
No new posts How to 'Ping' a CICS region in JCL CICS 2
No new posts Parallelization in CICS to reduce res... CICS 4
No new posts How to avoid duplicating a CICS Web S... CICS 0
Search our Forums:

Back to Top