using GETMAINs with sets



Support for CICS/ESA, CICS/TS & Transaction Gateway, CICS Configuration Manager and CICS Performance Analyzer

using GETMAINs with sets

Postby paulmac1968 » Tue Dec 31, 2013 10:23 pm

I feel like a bit of a dolt asking this but for many moons, my shop frowned on GETMAINs. Don't know why. Just weren't used. Well... I want to use it to pass more data than is allowed in the 32K DFHCOMMAREA. However, finding practical examples on the net hasn't been easy. Plenty of sample GETMAINs. Plenty of SETs. But find how they work together has been difficult. So here's what I want to do.

Program A is my first program. In this program I want to do my GETMAIN of a 01 level in Linkage other than my DFHCOMMAREA and store the address in a pointer variable housed within my DFHCOMMAREA. So I'm going to say Prog A needs to execute both a GETMAIN and a SET. What would a simple GETMAIN and SET look like?

Program B would then have control sent to it via an EXEC CICS LINK. How would I bring in the memory GETMAIN'd in Prog A? Just a SET command in Prog B? Would I need another GETMAIN statement?

Thanks.

Paul M.
paulmac1968
 
Posts: 23
Joined: Fri Aug 10, 2012 8:42 pm
Has thanked: 0 time
Been thanked: 1 time

Re: using GETMAINs with sets

Postby Robert Sample » Wed Jan 01, 2014 8:58 am

Why not use channels and containers? Redbook SG24-7227 is titled CICS Transaction Server V3R1 Channels and Containers Revealed and has a subtitle of Converting a COMMAREA based
application to use channels and containers
. While it is possible to do what I suspect you are asking about, it is not necessarily easy to code, is subject to production issues, and has at least the potential to cause storage issues.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: using GETMAINs with sets

Postby steve-myers » Wed Jan 01, 2014 11:53 am

Now I won't pretend to know much about CICS, but I think CICS wants to know about any storage allocated by a user program, so that if the user program fails or it does not clean up its storage on its own the CICS storage manager can free the storage. This cannot happen if a user program just does its own GETMAINs.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: using GETMAINs with sets

Postby paulmac1968 » Fri Jan 03, 2014 1:49 am

Robert,
I was thinking about Channels and Containers but I'm looking to augment an existing application that is not mine. C & Cs would be great if my folks and I were responsible for doing all the work and could convert from DFHCOMMAREA. But that isn't the case.

Basically I want to make extra info available to an existing app and I was bouncing between TS queues and GETMAINs. In a basic example, I want to set the extra info up in program A and then if some program down the line needs it, they go get it from the TSQ or from the memory I allocated in the GETMAIN.

Thx.

Paul
paulmac1968
 
Posts: 23
Joined: Fri Aug 10, 2012 8:42 pm
Has thanked: 0 time
Been thanked: 1 time

Re: using GETMAINs with sets

Postby Robert Sample » Fri Jan 03, 2014 3:23 am

EXEC CICS GETMAIN will allocate you memory; using the SHARED option will allow that memory to persist beyond task termination. You will need to store the address returned from the GETMAIN somewhere so every task wanting to access the memory can get to it; if the length of the memory acquired is not a constant then you'll need to store the length as well. When your subsequent program starts, assuming that the size is fixed and that GETMAIN-PTR is defined as USAGE POINTER and has the value from the SET option of the GETMAIN, and LS-AREA is the LINKAGE SECTION 01-level variable that you want to reference the GETMAINed memory with, your COBOL statement would be
SET ADDRESS OF LS-AREA TO GETMAIN-PTR
after which you could reference variables in LS-AREA normally.

Your application code will need to be carefully designed and checked since storage violations are quite easy to get with SHARED GETMAIN memory; if the transaction runs 1000 times a day and allocates a megabyte of memory, and the transaction allocates the memory every time instead of using previously allocated memory, by the end of the day your CICS region has 1 GB of memory tied up in your data structure -- which may (or may not) be possible at your site but DEFINITELY will cause your system programmers to be upset!
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: using GETMAINs with sets

Postby paulmac1968 » Sat Jan 04, 2014 12:58 am

Robert,

Thanks for your help. For my application, transactions are single threaded. No classic CICS pseudo-conversational flow. Therefore, I don't think I would need to make the GETMAIN SHARED. Plus, my extra memory is only 10K. Would you recommend TS Queues instead?

Thx.
paulmac1968
 
Posts: 23
Joined: Fri Aug 10, 2012 8:42 pm
Has thanked: 0 time
Been thanked: 1 time


Return to CICS

 


  • Related topics
    Replies
    Views
    Last post