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 OPEN in sub-module increases CPU, resolution please

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Mar 27, 2008 12:34 am    Post subject: Multiple OPEN in sub-module increases CPU, resolution please
Reply with quote

Hi,

There is a program AAAA which CALLs another program BBBB. In program BBBB two files (File-1 & File-2) are OPENed to READ.

Problem is, AAAA programs will run multiple times in a single Day, roughly 48 times. Every time it 'runs' it makes a CALL to BBBB which makes File-1 & File-2 to be opened that many times which increases CPU consumption significantly. How can I resolve this, please suggest.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Thu Mar 27, 2008 1:04 am    Post subject: Reply to: Multiple OPEN in sub-module increases CPU, resolut
Reply with quote

the only performance issue would be if the sub-program was called multiple times and each time opened and closed the dataset

let' s sum up the counts...

case 1..
prog-a calls prog-b one time prog-b opends and closes the datasets
... o penalty no optimizations to be done the datasets must be opended and closed for every main program run


case 2
same program structure as before but ...
prog-a calls prog-b many times

then there would be a performance issue irrelevant of how may times the main would run

but in this case all the setup should be reviewed,
...I do not know how to do it in cobol ,
but in pl/i the file definitions can be declared external
opened and closed in ythe main program and used by any subprogram

but, if the subprogram logic is to read every time from the beginning a dataset,
also that logic must be reviewed
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 27, 2008 1:26 am    Post subject:
Reply with quote

Hello,

Quote:
which makes File-1 & File-2 to be opened that many times which increases CPU consumption significantly.
If B is called 48 times and the files are opened/closed once per call, the impact should be nearly invisable. What is the indicator that cpu use is too high due to this?

Quote:
How can I resolve this, please suggest
This will depend on what the process is doing.

For starters, i'd capture counts of how many times these files are actually being opened/closed and how many records are being processed in them.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Mar 27, 2008 2:16 am    Post subject:
Reply with quote

Hi,

Thanks for the suggestions.


Enrico,

Program A recieves a file in every 30 minutes, there is a term SE-No., it is 'like' a key, SE-No. can have many entries in the file. Say it was 100 for one file, now Program B will be called 100 times. so my situation is 2nd case from your post. Further, yes, I'm looking for such a thing, it might help me.
Quote:
but in pl/i the file definitions can be declared external opened and closed in ythe main program and used by any subprogram


Dick,
Quote:
What is the indicator that cpu use is too high due to this?

One of my team member requested "Mainframe Performance, IBM" personnels about this & they say
Quote:
31% of the CPUTime is being spent in Opening and Closing files. If you count the Enqueue/Dequeue process, you can add an additional 10% to that figure. Without looking at your code, I would guess that the file(s) are being opened and closed multiple times for reasons unknown.

This made me to put the query on board.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Mar 27, 2008 2:46 am    Post subject:
Reply with quote

Hi Anuj,

Quote:
One of my team member requested "Mainframe Performance, IBM" personnels about this
What prompted them to ask the IBM performance people?

Quote:
31% of the CPUTime is being spent in Opening and Closing files. If you count the Enqueue/Dequeue process, you can add an additional 10% to that figure.
Strictly speaking over 40% of the cpu time is high for just open/close, but that approach may use the least cpu. . . If these 2 files each had 10million records, the cpu% for o/c would drop, but the overall cpu used would most likely significantly increase.

I guess my point is that the % alone may not be enough to react to.

What kind of data is in these 2 files? Might storing that data in database tables be helpful?
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Thu Mar 27, 2008 3:15 am    Post subject:
Reply with quote

Quote:
Program A recieves a file in every 30 minutes, there is a term SE-No., it is 'like' a key, SE-No. can have many entries in the file. Say it was 100 for one file, now Program B will be called 100 times. so my situation is 2nd case from your post.

If I understand this correctly, program B will be called for each record in each file and each time program B is called it opens the file reads the records and closes the file.

This should be redesigned to open and close the file only once for each time program A is executed. This may be done by making the file external and opening and closing it in program A or by only opening it the first time program B is called and closing it only the last time program B is called.

Other processing in these programs may also have to be redesigned to accomplish the business purpose of these programs while making them more efficient.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 02, 2008 9:00 am    Post subject:
Reply with quote

Hi,

Quote:
What prompted them to ask the IBM performance people?
This would need a good expalnation of my business I'm in... icon_smile.gif

Well, there are two terms ROC (Reocd of Charge) & SOC (Summary of Charge). SOC is summation of ROCs. One SOC can have multiple ROCs. Previously the JOB used to process only SOCs but now it's supposed to process SOCs. This increases CPU time significantly, enentually that prompted them to asl IBM.

Quote:
What kind of data is in these 2 files? Might storing that data in database tables be helpful?
They are the unload of DB2 tables.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Apr 02, 2008 9:14 am    Post subject:
Reply with quote

Hi,
Douglas Wilder wrote:
This should be redesigned to open and close the file only once for each time program A is executed. This may be done by making the file external and opening and closing it in program A or by only opening it the first time program B is called and closing it only the last time program B is called.
On these lines I'm planning to implement something but not getting a start on
Quote:
open and close the file only once for each time program A is executed.
because the processing on 'these' files are done in Program B.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 05, 2008 1:04 am    Post subject:
Reply with quote

As Enrico mentioned the only way that this scenerio can cause a performance problem is if the sub is CALLed for each rec processed.

98 OPEN/CLOSE pairs would not present a problem; 98 * 10,000 O/Cs will.

I know that 80K O/Cs increased a pgm's run time from 10 mins to 3 hrs.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Sun Apr 13, 2008 8:10 am    Post subject:
Reply with quote

Hi,

For the time being, I defined an array in Submodule & 'loaded' the file in these vaiable, for next CALL of sub-module, I refer to working-storage variables.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Apr 15, 2008 2:33 pm    Post subject:
Reply with quote

Hi,

Above worlking-storage solution is working fine for me.. icon_smile.gif
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm
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
No new posts How to get the program name of callin... pkmurali COBOL Programming 8 Mon Aug 01, 2016 3:36 am
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


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