Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Pointer usage in CICS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CICS
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    Post subject: Pointer usage in CICS
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Feb 24, 2012 4:04 am    Post subject: Reply to: Pointor usage in CICS
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    Post subject:
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    Post subject:
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    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Feb 24, 2012 10:25 pm    Post subject: Reply to: Pointer usage in CICS
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Feb 24, 2012 10:58 pm    Post subject: Reply to: Pointer usage in CICS
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Fri Feb 24, 2012 11:20 pm    Post subject: Reply to: Pointer usage in CICS
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CICS All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts CICS NEW SIT PARAMETERS CICS BEHAVIOR... Kyle Carroll CICS 0 Fri Nov 04, 2016 11:55 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us