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
 

 

Multi threading calls from COBOL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Feb 15, 2012 6:55 pm    Post subject: Multi threading calls from COBOL
Reply with quote

I have to optimise my current CPU utilization.
Scenario: I have to call 3 subprogrames from main program, so currently these programes are getting called one after another, but is there any way of calling these programes simultaneously?? if this can be achieved thru any of the CICS features then also its fine.
Please let me know in case of additional info.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Wed Feb 15, 2012 7:00 pm    Post subject:
Reply with quote

How is calling 3 subprograms in parallel going to have any impact on CPU time? They are all doing the same work, and using the same resources, so there's no CPU impact from what you want to do.

In CICS you can use START to create an independent transaction, so if you recode the subprograms to run as transactions, you could run all three of them in parallel. This may require massive changes to the application, of course, as they no longer would be subprograms but independent main programs, but it could be done. Of course, total CPU utilization will probably go up from the CICS overhead of starting three more transactions.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Wed Feb 15, 2012 7:28 pm    Post subject: Reply to: Multithreading calls
Reply with quote

Rohit, perhaps you can describe your problem to us, rather than look for a solution which may not help you at all.

By "CPU utilization" you mean the user wants a better response time, for instance?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 15, 2012 7:32 pm    Post subject:
Reply with quote

is this a batch application or cics?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Feb 15, 2012 7:43 pm    Post subject:
Reply with quote

a brief scenario of what your program does would help us to make suggestions.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Feb 16, 2012 8:35 am    Post subject: Reply to: Multithreading calls
Reply with quote

Thank you for all your replies..
Actually in the current project, we have various services that needs to be called from CICS environment.So currently I am taking very small example here, I am calling three services(Sub programes) from a driver CICS program(CICS) so they are getting executed seqentially, now my question was like instead of calling it sequentiall, is there any of calling/executing them parallel?
@Robert: You said is perfectly, but this change will not be only for 3 subprograms, as a mass level these would be hundreds of program that may get impacted.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Feb 16, 2012 8:37 am    Post subject:
Reply with quote

And yes, I really don't guess, how would CPU stats will be looking after this change, but yes certainly it will help to reduce the execution time.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Feb 16, 2012 8:41 am    Post subject:
Reply with quote

Also in a Batch, is there any way where we call the subprogram and don't expect control back again in the calling program? in CICS we have XCTL concept so anything similar to that in a batch?
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 685
Location: Earth

PostPosted: Thu Feb 16, 2012 10:21 am    Post subject:
Reply with quote

Something to think about your last question- how do you end the called program; GOBACK or STOP RUN..? Not a good programming practice, IMHO.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Feb 16, 2012 1:13 pm    Post subject: Reply to: Multithreading calls
Reply with quote

"Hundreds" of modules? Batch as well?

What is it you are imagining that you can do in this way? You need to be doing discrete tasks on discrete data guaranteed to be unaffected by other things happening at the time, in reality or potentiality. I'd really like to see how you imagine doing this for hundreds of different modules.

One thing you'd have to ensure is that users don't access the same data for update at the same time. That'd be fun.

And in batch?

Exactly, in some detail, outline what you imagine you would like to do, along with the benefits you'd feel would accrue, please.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 16, 2012 2:39 pm    Post subject:
Reply with quote

use TD queues with ATI in CICS if you want to have tasks started without returning.

in batch, use MQS with ATI to start tasks, which will not return.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Feb 16, 2012 3:41 pm    Post subject:
Reply with quote

Thank you for all your inputs,
We are fianally thinking of implementing this by the use of MQs.

@Bill:
Also in a batch is there any way of doing the same stuff??
I am imaging below things,
1)ProgA calls ProgB,ProgC,ProgD sequentially and each subprogram is updating into some DB2 table, and these sub programes are independent on each other(No common tables between them)
2)Now instead of calling them sequentially, Can we call them parallel and get the updations done as the total elapsed time in a job can be reduced?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Feb 16, 2012 4:07 pm    Post subject:
Reply with quote

Quote:
Can we call them parallel and get the updations done as the total elapsed time in a job can be reduced?


as explained earlier, initiating separate enclaves (batch multi-threading)
actually uses more resoures than simple CALLs within a thread.

and, the only way you are going to reduce elapsed time is:
  1. buy more hardware
  2. reduce the number of jobs running
  3. find the bottlenecks in you code and optimize
  4. redesign


and actually, 3 and 4 will only reduce CPU, which may or may not affect ELAPSED,
especially if 1 and 2 are not optimal.

suggestion: forget about multi-threading as a solution to your problem.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Thu Feb 16, 2012 4:20 pm    Post subject: Reply to: Multithreading calls
Reply with quote

the whole topic is a complete waste of time ....
mostly due to poor terminology
let's start with
Quote:
I have to call 3 subprogrames from main program,

the sentence implies that after each call the control is returned to the main program
and running the 3 subprogram in <parallel> means some synchronization has to take place so that the main program resumes it' s flow only after all the 3 subprogram have finished their processing.
now if the subprograms were doing each a 10000by10000 matrix inversion
it might be worth to try to run them in parallel, but ....

... and now at the end it comes out that they are going to use MQ

most puzzling topic around
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Feb 16, 2012 5:34 pm    Post subject:
Reply with quote

Thanks a ton again!!
@Enrico:
I would certainly have enrich my terminology, so as to avoid the confusion.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Thu Feb 16, 2012 6:37 pm    Post subject: Reply to: Multithreading calls
Reply with quote

For batch it is simple. Design your system so that related tasks are in one job, unrelated tasks in others. Of course, don't do this and have each processing a huge amount of input, most of which is ignored..
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 17, 2012 12:16 am    Post subject:
Reply with quote

you mention DB2.


how often are you issuing COMMITs?
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Fri Feb 17, 2012 12:59 pm    Post subject:
Reply with quote

I am issuing commit once in the main program( i.e when call to all the sub progs are successful).
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 17, 2012 1:11 pm    Post subject: Reply to: Multithreading calls
Reply with quote

Quote:
We are fianally thinking of implementing this by the use of MQs.


Quote:
I am issuing commit once in the main program( i.e when call to all the sub progs are successful).

so You need a <synchronization> point after all the subprograms have <finished>
how does MQ fit in all this?

the hole is getting deeper and deeper ...
icon_eek.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Fri Feb 17, 2012 2:09 pm    Post subject: Reply to: Multithreading calls
Reply with quote

If you want to improve throughput, why not look at the problems in the existing programs, rather than try to invent some way around it?

You seem to be introducing extra complexity without any surety of benefit as regards throughput. Test it thoroughly with a dummy set of modules to prove the concept as it applies to your system. For performance issues the biggest improvements, after things caused by plain stupidity, are from changes to how existing logic is implemented, but to the extent of doing it "better" rather than doing the same thing is some magic new way.

By the way, can we assume you mean you commit once after each set of calls, rather than "once" fullstop?
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 -> COBOL Programming All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm


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