Skip to Content
0
Former Member
Jun 02, 2011 at 01:49 PM

Waiting Jobs to end

55 Views

Hi guys,

I have a program that generates a file of +500.000 registers (with a lot of info ecah) to the server. I have splitted the program in multiple jobs to make it performant,and after that I managed the program continues to create one single file from a Z table (which is filled by the Jobs).

The questions are:

1 - Do I have to Lock the table when doing the insert command in each job?

2 - The program needs to wait until all jobs are finished. How can I programm that?

Here an example of the code implemented to create multiple jobs:

DATA: L_CANT_REG TYPE RSEUMOD-TBMAXSEL.

CONSTANTS: DC_SIGN TYPE CHAR1 VALUE 'I',

DC_OPTION TYPE CHAR2 VALUE 'EQ'.

CLEAR: RA_BPCONTACT. REFRESH RA_BPCONTACT.

LOOP AT I_BCONT INTO R_BCONT.

RA_BPCONTACT-SIGN = DC_SIGN.

RA_BPCONTACT-OPTION = DC_OPTION.

RA_BPCONTACT-LOW = R_BCONT-BPCONTACT.

APPEND RA_BPCONTACT.

DESCRIBE TABLE RA_BPCONTACT LINES L_CANT_REG.

IF L_CANT_REG EQ P_CANREG.

PERFORM F_EJECUTAR_JOB.

CLEAR: L_CANT_REG, RA_BPCONTACT.

REFRESH RA_BPCONTACT.

ENDIF.

ENDLOOP.

IF RA_BPCONTACT IS NOT INITIAL.

PERFORM F_EJECUTAR_JOB.

CLEAR: L_CANT_REG, RA_BPCONTACT.

REFRESH RA_BPCONTACT.

ENDIF.

Many thanks in advance!!!

LUCAS