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

Hi preventing parallel processing for a program treating open dataset

Former Member
0 Likes
720

Hi

Has anyone come into a situation where he had to do an inbound interface

(i.e using open dataset by scanning all the file in AL11)

how do you treat program running in parallel in this situation.

what i mean is that if the same program is doing an open dataset and treating the same file in al11. Then inconsistencies may occur

is there a way to lock a program that is running that is triggering an error message "

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
478

Hi,

I too faced a similar situation and this is what I implemented.

Whenever your programs starts processing a particular AL11 File, Create a New Flag File in the Same Directory.

Say if my file name is usr\bin\ABC.DAT, before OPEN DATASET command on this file, I would create a new file usr\bin\ABC.DAT.FLAG!!!.

After the processing ABC.DAT is done, I delete the Flag File.

In the mean time, If some other program, (or for that matter the same program) executes in a different session and tries to open the same file, we can check for the existence of the FLAG FILE.

So the code is as follows.

CHECK for the Existence of FLAG FILE.

If FLAG FILE Exists, STOP. " another session is processing it.

ELSE.

CREATE FLAG FILE.

OPEN DATASET, and rest others.

CLOSE DATASET.

ENDIF.

Hope this helps.

Thanks,

Surya

2 REPLIES 2
Read only

Former Member
0 Likes
478

look at Rich's reply in this [thread.|;

Read only

Former Member
0 Likes
479

Hi,

I too faced a similar situation and this is what I implemented.

Whenever your programs starts processing a particular AL11 File, Create a New Flag File in the Same Directory.

Say if my file name is usr\bin\ABC.DAT, before OPEN DATASET command on this file, I would create a new file usr\bin\ABC.DAT.FLAG!!!.

After the processing ABC.DAT is done, I delete the Flag File.

In the mean time, If some other program, (or for that matter the same program) executes in a different session and tries to open the same file, we can check for the existence of the FLAG FILE.

So the code is as follows.

CHECK for the Existence of FLAG FILE.

If FLAG FILE Exists, STOP. " another session is processing it.

ELSE.

CREATE FLAG FILE.

OPEN DATASET, and rest others.

CLOSE DATASET.

ENDIF.

Hope this helps.

Thanks,

Surya