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
 

 

Multiple Packages - Confusion

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jun 10, 2013 12:23 am    Post subject: Multiple Packages - Confusion
Reply with quote

Hi,

I got a doubt, while I was reading about packages.

Consider a scenario:

Subsystem - DB2A

I have a Package - PackageA.
This package is a cobol program which insert current timestamp in CREATOR1.TABLE1. This Package is in collection collA bound under planA.

The package is bound with QUALIFIER(CREATOR1) so when we run the JCL using appropriate Loadlib and Dbrmlib, PackageA gets executed successfully.

Now suppose, I create a duplicate version of the table as CREATOR2.TABLE1 and bind the same package PackageA using same DBRMLIB with QUALIFIER(CREATOR2) in a different collection say CollB.

also this CollB is part of same planA.

Now when I run the same JCL, how does DB2 identify it has to refer PackageA of CollA or CollB?

I think my question may sound stupid, but it just stuck to my mind. I don't have required access to system test this scenario.

Thanks in advance
Back to top
View user's profile Send private message

Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2171
Location: @my desk

PostPosted: Mon Jun 10, 2013 10:37 am    Post subject:
Reply with quote

gylbharat,

This might be of some help

http://ibmmainframes.com/about18241.html
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Mon Jun 10, 2013 1:45 pm    Post subject:
Reply with quote

Thanks Arun... This is very helpful. So I understand that whenever we want to refer to a particular collection, we will pass the correct collection name using linkage section to the program... and call "SET PACKAGESET" statement to point to correct collection.

Also in the thread, there is a question
Quote:

Hi UmeySan,
Thanks a lot for such detailed information...

Select territory from sales
Here sales tables can be present in region1,region2 or region3
We can bind it accordingly to the 3 regions and we can set the packageset to any one of the 3 regions as and when required.

But what if I have to access sales in both region1 and region 2 at the same time...? We can make it point either to region1 or region2 only.

Can we access multiple regions...?
Is it possible....?


Now suppose, program insert data in territory table. I want to insert data in region1.territory and region2.territory using the same program (without running it two times) then I should 1st use "SET PACKAGESET = 'REGION1' " and execute my insert statement and then "SET PACKAGESET = 'REGION2' " and again execute the insert statement within the same program. Will this work?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jun 11, 2013 2:19 am    Post subject:
Reply with quote

This is an interesting question. To best of my knowledge, package release can occur when program is bound with RELEASE(COMMIT) and program issues a COMMIT. If the program is bound with RELEASE(DEALLOCATE), program thread has to terminate before DB2 looks for package again.

I will recommend testing this scenario to confirm the answer.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jun 11, 2013 2:28 am    Post subject:
Reply with quote

Quote:
I don't have required access to system test this scenario.

I just read your original post again. I will try to test this (at my leisure of course) and let you know unless someone else on the forum beats me to it.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Tue Jun 11, 2013 5:55 pm    Post subject:
Reply with quote

Quote:
Now when I run the same JCL, how does DB2 identify it has to refer PackageA of CollA or CollB?


Which ever program is listed first in your SYSIBM.SYSPACKLIST will be the package used. It is the first one listed when you did a BIND PLAN.

Quote:
Now suppose, program insert data in territory table. I want to insert data in region1.territory and region2.territory using the same program (without running it two times) then I should 1st use "SET PACKAGESET = 'REGION1' " and execute my insert statement and then "SET PACKAGESET = 'REGION2' " and again execute the insert statement within the same program. Will this work?


This should work. If your 'region1' package is first in the packlist then you do not need the Set Current PACKAGESET command the first time. It will default to that.

Quote:

I don't have required access to system test this scenario.


I hope this is all theory, becuase this fact makes the whole thing a little scary.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jun 11, 2013 7:03 pm    Post subject:
Reply with quote

Quote:
If your 'region1' package is first in the packlist then you do not need the Set Current PACKAGESET command the first time. It will default to that.

Not necessarily. This will be true for the very first execution only. For the next execution, it will depend on RELEASE parameter. If the CURRNET PACKAGESET value is blank, it will use whichever SKPT is available in EDM pool. Please refer to UmeySan's post mentioned in the second response .

In my previous posts I have mentioned the same concept.
My hesitation was , does DB2 look at PACKAGESET value at every SQL statement? or does it look for package after releasing current SKPT only? (which happens after COMMIT or THREAD termination based on RELEASE parameter) .

Apparently, it has to happen after every SQL statement otherwise first switch also wouldn't work. Any objections?
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Tue Jun 11, 2013 7:23 pm    Post subject:
Reply with quote

All I can tell you the way we have implemented the process successfully.

Packlist for PLANA:
REGION1.*
REGION2.PROGB

PROGA is Driver Program
CALL PROGB
PROGB executes updating tables in REGION1
GOBACK

PROGA continues
SET CURRENT PACKAGESET = REGION2
CALL PROGB
PROGB executes updating tables in REGION2
GOBACK

PROGA continues
GOBACK (Job done)
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Tue Jun 11, 2013 7:35 pm    Post subject:
Reply with quote

What is the RELESE parameter used in package bind?
Above approach will work if RELEASE(COMMIT) was used. RELEASE(DEALLOCATE) may cuase updates in REGION2 for second execution if the last loaded package was of REGION2.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Tue Jun 11, 2013 7:42 pm    Post subject:
Reply with quote

We use: RELEASE(DEALLOCATE)

We may not have an issue because the second execution is a re-invocation of the Plan itself. I guess everthing starts again.
Back to top
View user's profile Send private message
gylbharat

Active Member


Joined: 31 Jul 2009
Posts: 565
Location: Bangalore

PostPosted: Wed Jun 12, 2013 12:02 am    Post subject:
Reply with quote

Thanks Everyone, I have now got more insight into the concept.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm
No new posts Execute multiple DB2 Load commands in... faizm DB2 4 Wed Aug 03, 2016 12:53 pm
This topic is locked: you cannot edit posts or make replies. JCL MULTIPLE STEP EXECUTION QUERY Susanta JCL & VSAM 18 Sat Jul 30, 2016 1:17 pm
No new posts Multiple parameters Csongor All Other Mainframe Topics 16 Thu Jun 09, 2016 7:54 pm
No new posts Define Alias for multiple Data sets u... sandy98669 JCL & VSAM 4 Fri May 27, 2016 1:07 pm


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