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

Doubt regarding MASSINSERT.


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

New User


Joined: 08 Jul 2010
Posts: 3
Location: Gurgaon

PostPosted: Sun Aug 22, 2010 1:42 pm
Reply with quote

I have a requirement, in one of my CICS program to Copy several records in a VSAM file.
ie: If my record is like
NY001
NY002
NY003
If the users wants to COPY all the records for NY and create for LA

I have to read the above and write the records as

LA001
LA002
LA003

In such a scenario, can i use a WRITE MASSINSERT ?
i loading all the NY records to an internal table and then how will i be able to use the massinsert?
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: Sun Aug 22, 2010 4:56 pm
Reply with quote

MASSINSERT is a very handy API feature when writing records to a VSAM file. Instead of many EXCP's, there's only a few, because the records are written (under the covers), usually via a "PUT" at the CI-level.

The key in using MASSINSERT is that the records must be sequential in nature.

As you can probably surmise, MASSINSERT works well for ESDS, because the writing of records is always sequential and this is primarily where I've used it.

But, KSDS can be different as it relies upon the fact that the programmer has ensured that these keyed-records are in sequential order and therefore, would be written in key-sequenced order. You wouldn't want to use MASSINSERT for a group of random writes, spread out all over the cluster.

Note; After issuing a WRITE MASSINSERT, you must issue an UNLOCK or if you're close to task termination, an implicit UNLOCK would be issued by CICS. But I'd be more inclined to use the explicit UNLOCK in the program, because you don't want to lockout CI's to another task and the UNLOCK provides this immediate ability.

Bill
Back to top
View user's profile Send private message
ramiyer999

New User


Joined: 08 Jul 2010
Posts: 3
Location: Gurgaon

PostPosted: Sun Aug 22, 2010 7:11 pm
Reply with quote

Hi Bill,
Thanks for the INFO.

In my case, the file i am writing to is a KSDS file with a group-key
(NY + 001),(NY + 002) is my key. So the records that i am writing will be in a sequential order.
I have loaded them in the same sequence into an internal table.
But loading the file completely and writing out the records one by one is taking a lot of time. Time for writing out 6000 records is atleast 10 seconds.
Will you be able to provide me a sample code the MASSINSERT ?

This is the first time i am using a MASSINSERT, dont wanna create a lock or make my CICS region go in hung state.

Thanks in advance.
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: Sun Aug 22, 2010 8:19 pm
Reply with quote

I'm not surprised it takes some time to randomly add 6000 individual records, but 10 minutes is high.

Actually, the API is a WRITE, except you add the MASSINSERT keyword. I also recommend specifying the KEYLENGTH keyword. Your System Programmer will thank you for this. icon_wink.gif

So, you would write each record using individual WRITE API's, but with MASSINSERT. But, when you're done writing all records, you should issue an immediate UNLOCK API.

During the time you're issuing the WRITE's, each record is being buffered into a temporary memory location and the actual PUT to the cluster is deferred.

The CONTROLINTERVALSIZE will certainly impact the amount of time it takes for all of these new records to be written to the Cluster.

As far as efficiencies, a small CISZ will not be much better than individual WRITE's, without MASSINSERT.

A larger optimized data CISZ (IE: 18432) will cause CICS to write all records it can contain within the larger CI and therefore, reduce your EXCP's significantly. Also, optimized index CISZ's (IE: 2048) are equally important.

Also, ensure you have adequate FREESPACE (FPSC) for the CI and CA.

CI splits are a nature of VSAM but, you want to try and reduce the number of CA splits to a minimum as a CA split causes VSAM to perform a mini on-line/in-place "REORG" and could take (at worse case) 1-2 minutes to complete.

Download the following link (VSAM Demystified) -

www.redbooks.ibm.com/redbooks/pdfs/sg246105.pdf

Bill
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 Doubt about pl/1 (job offer) General Talk & Fun Stuff 5
No new posts doubt when executing a file when logg... TSO/ISPF 2
No new posts Doubt in MFS IMS DB/DC 2
No new posts Doubt on GETMAIN, FREEMAIN behaviour CICS 3
No new posts Doubt in using command code O IMS DB/DC 4
Search our Forums:

Back to Top