Use of INDEPENDENT-Variable vs. Amount of CPU-Usage

Hi,

we have a subroutine which is used by differnent programs. This subroutine defines a INDEPENDENT-Variable (AIV)
INDEPENDENT
1 +URQG007-UMBRECHEN-TAB (A229896)
1 REDEFINE +URQG007-UMBRECHEN-TAB

which contains a three dimension array. This AIV is populated when the subroutine is called for the first time. It contains data which is static all over the session.
We use the AIV to avoid reading the ADABAS-Files over and over again to get the data.

The problem is that we recognized that after the population of the AIV the amount of CPU-Usage doubles for the rest of the session.
Date ; Time from ; Time until ; CPU-Amount ;Sub-Program
2018-03-13; 8:40:46,89; 8:40:46,94;AK6CICC9;JB30;K26N; 0:00:00,008358;XGP007AN - Uses AIV
2018-03-13; 8:40:47,27; 8:40:47,88;AK6CICC9;JB30;K26N; 0:00:00,029986;URQG007N - does the Population of the AIV
2018-03-13; 8:40:48,03; 8:40:48,08;AK6CICC9;JB30;K26N; 0:00:00,015569;XGP007AN
2018-03-13; 8:40:48,24; 8:40:48,28;AK6CICC9;JB30;K26N; 0:00:00,017826;XGP007AN
2018-03-13; 8:40:54,49; 8:40:54,56;AK6CICC9;JB30;K26N; 0:00:00,016950;XGP007AN
2018-03-13; 8:40:54,92; 8:40:55,06;AK6CICC9;JB30;K26N; 0:00:00,025766;XGP007AN
2018-03-13; 8:40:55,36; 8:40:55,38;AK6CICC9;JB30;K26N; 0:00:00,015432;XGP007AN

When we change the definition to a normal variable the amount of CPU-Usage is nearly the same.
Any ideas?

Regards Wolfram Theurer

I am a bit confused about your description of what is happening. Here are the first three lines from your timing run:

Date ; Time from ; Time until ; CPU-Amount ;Sub-Program
2018-03-13; 8:40:46,89; 8:40:46,94;AK6CICC9;JB30;K26N; 0:00:00,008358;XGP007AN - Uses AIV
2018-03-13; 8:40:47,27; 8:40:47,88;AK6CICC9;JB30;K26N; 0:00:00,029986;URQG007N - does the Population of the AIV
2018-03-13; 8:40:48,03; 8:40:48,08;AK6CICC9;JB30;K26N; 0:00:00,015569;XGP007AN

On line 1, “Uses AIV”, how are you using the AIV if it is not populated yet? Are you using a three dimensional array? What does it have in it?

On line 2, you are populating the AIV. Fine, the timing is unrelated to the use of the AIV.

On all the subsequent lines, you are using the AIV. Presumably, you are doing a 3D array. Or, have you redefined the AIV as a one dimensional array and computed the appropriate 1D subscript.

Could you clarify the REDEFINE of the AIV, and the “Uses AIV” operation?

Hi Steve,

  1. “Uses AIV” means that the AIV ist defined in that program and it makes use of that variable. The fields of the 3D-Array contain values which tells the program XGP007N how format an adress and calculates how to split the address into lines.
  2. The program URQG007N is a subprogram to XGP007N. It is called on the first call of XGP007N only.
  3. whole definition of the AIV
    INDEPENDENT
    1 +URQG007-UMBRECHEN-TAB (A229896)
    1 REDEFINE +URQG007-UMBRECHEN-TAB
  • 1 URQG007-UMBRECHEN-TAB (A229896)
  • 1 REDEFINE URQG007-UMBRECHEN-TAB
    2 W-ID-MANDANT (N8)
    2 W-DEL-POS-SPACE (I4)
    2 W-TAB
  • Trennzeichen (DELimiter)
    3 W-DEL-USED (I4)
    3 W-DEL-ZEILE (1:8)
    4 W-DEL-ADD-LEN (L)
    4 W-DEL (A250)
    4 W-DEL-LEN (I4)
  • Umbruchblockierer Teil 1: VOR dem Trennzeichen
    4 W-TEIL-1-USED                  (I4)
    4 W-TEIL-1-ZEILE                 (1:7)
      5 W-TEIL-1                     (A250)
      5 W-TEIL-1-LEN                 (I4)
    
  •   Umbruchblockierer Teil 2: NACH dem Trennzeichen
      5 W-TEIL-2-USED                (I4)
      5 W-TEIL-2-ZEILE               (1:15)
        6 W-TEIL-2                   (A250)
        6 W-TEIL-2-LEN               (I4)
    

I have the presumption that the system pages out the space of the variable. Is there a way to tell the system to keep the space in memory?

Regards Wolfram Theurer

Please correct me if my assumptions are incorrect:

2018-03-13; 8:40:46,89; 8:40:46,94;AK6CICC9;JB30;K26N; 0:00:00,008358;XGP007AN - Uses AIV

In the step above, XGP007AN has been invoked the first time. It recognizes that this is the first time, and therefore invokes URQG007N. No work has been done using the array, since there is no data yet.

2018-03-13; 8:40:47,27; 8:40:47,88;AK6CICC9;JB30;K26N; 0:00:00,029986;URQG007N - does the Population of the AIV

In the step above, the array is loaded with data. Again, no work has been done using the array; the array is simply loaded.

2018-03-13; 8:40:48,03; 8:40:48,08;AK6CICC9;JB30;K26N; 0:00:00,015569;XGP007AN

In the step above, you are doing the first “work” using the data. All the steps from here on out are consistent.

The first and third steps are not the same. The first is only recognizing that it needs to load data; it does not process the data. The third step is the first step that processes the data.

So, you cannot compare the first step with the series of steps after the data is loaded since they are really doing different things, although it is the same XGP007AN performing different functions.

It is is not like that.
Step 1: Call XGP007N
→ Calls URQG007N (Step 2) Populates the AIV
→ Does the work he is told according to the parameters
Step 3: Call XGP007N
→ Skips calling URQG007N because he detects that the AIV is populated
→ Does the work he is told according to the parameters

Another example

It’s interesting that your CPU usage is more consistent with local variables.

With +URQG007-UMBRECHEN-TAB being so big, this might be a memory issue. Try increasing your thread size. The SYSTP utility may provide helpful information on this.

Array processing can be CPU-intensive.

  • Are all your index variables defined as I4? They should be.
  • Can you replace FOR loops with index ranges? For example
ASSIGN W-DEL (#I : #I + 4) = #W-DEL (#J + 1 : #J + 5)

It’s difficult to offer more advice without seeing your code.

It is is not like that.
Step 1: Call XGP007N
→ Calls URQG007N (Step 2) Populates the AIV
→ Does the work he is told according to the parameters /* who does the work? XGP007N?
Step 3: Call XGP007N
→ Skips calling URQG007N because he detects that the AIV is populated
→ Does the work he is told according to the parameters

Looking at what you have posted, it appears that XGP007N tests to see if it is necessary to populate the AIV BEFORE doing the work as per the parameters. If so, the first line of output has no relationship to subsequent XGP007N timings.

Take a look at the Time From and Time Untils. Where is the first place that XGP007N does “work”? It would appear that it is after the call to URQG007N. Who does the work shown above in your last post on the line with the red comments (which are actually questions).

@Ralph: All of the index variables are defined I04. It will be heavy work to replace the for loops because we have an array of 10 x 50 x 50 items.
But thanks for the hint to SYSTP. I will check this. And I will check the thread size. I assume it should be greater than the size of the AIV.

@Steve: Your first sentence is right. The second not because XGP007N does always some work. If called for the first time it does the additional work of populating the AIV (Calling URQG007N). The protocol is made by the CICS Monitoring.
Regards Wolfram

I checked the thread size. It is 3MB. With an variable of 6.5MB plus the space used for the programs the OS is forced to page in and out.
Our admin said that he will not rise the thread size because of the impact on the whole system.
The conclusion now is to reduce the size of the variable or to read the data from the file. Whiel reading the data from the file only the subroutine ist affected. Thanks to Ralph and Steve.

Regards Wolfram