Generic IMS subroutine



IBM's hierarchical database management system with a Database Manager (IMS DB) and a Transaction Manager(IMS DC)

Generic IMS subroutine

Postby ramesh1229 » Mon Jul 11, 2011 4:33 pm

Hi ,
I have a requirement to seperate IMS database calls from the current existing programs and put it in subroutine which is a generic program to access
perticular database and it need to be in a way that it can handle all type of calls(GU,GN,ISRT,REPL,etc...) and all levels of segments(ROOT,LEVEL2......)

From mainprogram i will pass the type of call,if it is qualified i will pass required SSAs and subprogram need to evaluate these values and build the call
and access IMS database and finally it will return to the main program with return code and IO-AREA.
Can any one please help me how to handle these things in subprogram.

Regards,
Ramesh.
ramesh1229
 
Posts: 2
Joined: Tue Jul 05, 2011 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generic IMS subroutine

Postby Ed Goodman » Mon Jul 11, 2011 6:52 pm

The simple answer is to say that you need to put the linkage-section areas from the main program into the call to the subprogram. I doubt that will work for you though.

Since this is your first post, and you are asking for help with something very complex, I'm guessing this is all new to you.

Do you have any control over the programming of the main programs? As in, if I said to use the AIBTDLI call instead of the CBLTDLI call, would you be able to make it happen (or at least influence it)?

Also, do you mean that a given subprogram will need to handle calls to ALL databases, or will each one handle a SINGLE database?
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Generic IMS subroutine

Postby Ed Goodman » Mon Jul 11, 2011 7:00 pm

By the way, we have several programs that do just what you are asking about for a single database each. They were written decades ago to handle a large database that was split into ten sections due to size. (Before HALDB was available).

Each main program needs to have the PCBs for the ten databases in their PCB. Those PCBs are coded in the linkage section of the main program, and also in the calls to the subroutine.

Does this help at all? I can give you a lot more detail if needed.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Generic IMS subroutine

Postby ramesh1229 » Tue Jul 12, 2011 5:00 pm

Thanks for your valuable suggestions.In detail what i mean is i need to write a subroutine to handle all types of calls
for a perticular database.From main program what i will pass is key data for required segments and function code,io area
and PCB, in subroutine it has to build SSAs and evaulate the levels up to where it has to go to fetch or update the required
segments.
Here my concerns are if the subroutine is generic IMS program what are the things i need to take care in order to make
subroutine as generic one.
1.Do i need to build SSA in subroutine or not

2.Suppose if i need to access third level , then in subprogram can i access directly to third level
or first i need to check for first level key is > spaces access that and second level key > spaces access second
level segment and then third level key > spaces access third segment and for fourt level since we have n't passed
key so stop retrieving the segments and pass the IO AREA back to main program.

3. Do i need to write seperate calls for each level for all type of fucntion codes how it would be look like including
inserting and replacing segments.

4.please suggest me what other steps i need to take care apart from the above which i mentioned.
Finally is writing generic subroutine for IMS calls is good approach or not if yes what are the advantages and
if not what are the disadvantages for this.
If possible please give me some sample code if you have on this so that i can apply

Regards,
Ramesh.
ramesh1229
 
Posts: 2
Joined: Tue Jul 05, 2011 9:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generic IMS subroutine

Postby Ed Goodman » Thu Jul 14, 2011 8:34 pm

As far as IMS is concerned, there is no main program vs a subprogram. So any calls you make in the main program will affect the PCB the exact same as if you coded them in the subroutine.

For example, I can do a GU in the main program, then call the subroutine with the PCB. The subroutine can then do a GN without having to re-do the GU call against that same PCB. This works because you are passing pointers to the PCB in the linkage section of the main program.

I'm guessing a little bit here, but it sounds like you are asking about making different level calls using the same code. I can tell you that there is an optional parm in the CBLTDLI interface that tells IMS how many parms you intend to pass. It will SOMETHING like this:
CALL 'CBLTDLI' USING WSP-DLI-PARM-COUNT                 
            WSP-DLI-FUNCT WGPC02RI-PCB           
            WSP-IO-AREA                           
            WSP-SSA-LEVEL-1 WSP-SSA-LEVEL-2
            WSP-SSA-LEVEL-3 WSP-SSA-LEVEL-4
            WSP-SSA-LEVEL-5 WSP-SSA-LEVEL-6
            WSP-SSA-LEVEL-7 WSP-SSA-LEVEL-8


Notice that first parm? It will contain a decimal number telling IMS how many parms you want to pass. So if you only have one SSA, you put a 4 in there. That gets the function, the PCB, the I-O area, and the first SSA. If you go to three levels, put a 6 in there.

You can build the SSAs anywhere. They just need to be there for the CBLTDLI call. So you can build them in subroutine or pass them from main program.

As for pros/cons, that's a complex answer. I think the biggest factor is WHY you want to separate them.

If you don't want programmers to have to know "how do I find the list of accounts held by customer x". Then you are putting the business logic in the subroutine. It will need to take a customer id and do all of the calls needed to build the list of accounts, then pass that list back to the main program. That gets into some "object oriented" thinking, where you are basically writing data retrieval functions. Each function will need it's own interface.

If you are just writing a bare bones IMS calling routine so that "developers don't have to know IMS," then it's probably a bad idea. Each developer will still need to know how the data is structured, and how to call the new subroutine. All of the same error checking has to occur too.

So...the short answer is that it depends.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Generic IMS subroutine

Postby humble » Tue Apr 10, 2012 4:21 pm

Hi, I have a query regarding subrotines. I am adding it to this thread.

I know we can call a subroutine from MPP programs. I just want to know whether we need to define the subroutine name in the IMS first. (Like how we define the MPP programs).

Thanks in advance
humble
 
Posts: 9
Joined: Thu Mar 01, 2012 5:01 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Generic IMS subroutine

Postby Ed Goodman » Tue Apr 10, 2012 8:21 pm

No you don't need to. If the subroutine is never called as its own transaction, and it does not have its own PSB, then there is nothing to define.
Ed Goodman
 
Posts: 341
Joined: Thu Feb 24, 2011 12:05 am
Has thanked: 3 times
Been thanked: 17 times

Re: Generic IMS subroutine

Postby humble » Wed Apr 11, 2012 11:34 am

Hi Ed Goodman, Ok. Thanks for your reply.
humble
 
Posts: 9
Joined: Thu Mar 01, 2012 5:01 pm
Has thanked: 0 time
Been thanked: 0 time


Return to IMS DB/DC