View previous topic :: View next topic
|
Author |
Message |
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Quote: |
What prompted them to ask the IBM performance people? |
This would need a good expalnation of my business I'm in...
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Above worlking-storage solution is working fine for me.. |
|
Back to top |
|
|
|