Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

OPEN CURSOR WITH HOLD problem in a parallel programm

former_member205645
Participant
0 Likes
1,431

Hello Gurus,

i am running a 20 job parallelized programm, that reads two database tables:


 IF l_flg_second_time = con_off.
    l_flg_second_time = con_on.
    OPEN CURSOR WITH HOLD l_var_cursor FOR
    SELECT * FROM avor2 WHERE vtref IN s_vtref.
  ENDIF.

  TRY.
    FETCH NEXT CURSOR l_var_cursor
    INTO CORRESPONDING FIELDS OF TABLE c_tab_avor2
    PACKAGE SIZE p_block.
  ENDTRY.
  IF sy-subrc NE 0.
    c_flg_exit = con_on.
    CLOSE CURSOR l_var_cursor.
    EXIT.
  ENDIF.

  DESCRIBE TABLE c_tab_avor2.

  IF sy-tfill < p_block.
    c_flg_exit = con_on.
    CLOSE CURSOR l_var_cursor.
  ENDIF.
....
....
....
SELECT * FROM EAKO ...

The second job gets terminated with a Dump (Runtime Error "DBIF_RSQL_INVALID_RSQL"):

Error analysis

When attempting to open a cursor for a SELECT or OPEN CURSOR, all 16

cursors of the SAP-internal database interface were already in use.

The failed statement accesses table "EAKO ".

Does anyone know where can i find the customizing for the Cursors so that i can compare more SAP Systems because i have other programms that ar parallelized in the same manor and have no problems running.

Thank you in advance.

Regards Ioan.

5 REPLIES 5
Read only

former_member182114
Active Contributor
0 Likes
821

Hi Ioan,

If I understood your strategy correct you are trying to use one cursor for all your parallel executions, isn't it?

But I'm guessing you are failling to keep it only one,

How these variables are being controlled in global execution?

l_flg_second_time

l_var_cursor

In case it are being initialized for each execution, you are oppening one cursor for each program so wasting the resources...

Regards, Fernando Da Ró

Read only

0 Likes
821

Hello Fernando,

thank you for the answer. I have 20 different jobs and each job needs it's own cursor because each job has its own interval(range) for the select.

Example:

Job 1: Interval 1-10

Job 2: Interval 11-20

Job 3: Interval 21-30

....

Because i can't open more then 16 cursors at one time my idea was to wait for on job to finish. Unfortunately the WAIT instruction only works with seconds and thats too much, i need microseconds or milliseconds. So i replaced the cursor with DO-ENDDO and a select.

Regards Ioan.

Read only

0 Likes
821

Hi Ioan,

Why are you using OPEN CURSOR and not SELECT INTO TABLE?

How many entries have on table avor2 and how is the result set expected for each SELECT on it?

Also maybe you can use SELECT field1,field2 despite use SELECT * to save some memory and network but it depends of the structure of avor2 and the fields you want to use.

Regards, Fernando Da Ró

Read only

0 Likes
821

Hello Fernando,

well it is a 4 row more than 2 milion lines table and the 4 rows are key fields. I did't want to use select because of the DO ENDDO loop, but it's good now

Regards,

Ioan.

Read only

0 Likes
821

Hi, how can you do parallel job without open cursor?

I think it will cause a dump if you write SUBMIT or STARTING NEW TASK

in select endselect.