简体   繁体   中英

Do batch jobs share the same QTEMP library on AS400?

Suppose there is a program, which copies a file to temp, does some manipulation to the data and copies it back. Now if I submit it to run in batch for twice, there will be two batch jobs which are likely to do the same file tricks in the same time. Is one going to cause trouble to the other, like distorting the data of the other, since the file is located in the same library? What is going to happen? Let us say object lock is not an issue here.

QTEMP is unique to each individual job on the system and all objects created in the jobs QTEMP library are removed when the job ends.

Therefore in your example each batch job will have it's own unique QTEMP library and will not interfere with the other.

I think you will always have a problem with distorted data under these circumstances: Job 1 updates birthdate; Job 2 updates postal code

Job 1 cpyf prod/x qtemp/x
Job 2 cpyf prod/x qtemp/x
Job 1 call updbirth
Job 2 call updpostal

at this point, there are three separate copies of file X:

1) Production. Neither postal code nor birth date have been updated, but some other job may have updated name and address. Updates made to this copy are not reflected in Job 1 or Job 2's copy of file X

2) Job 1. This copy has updated birth dates, but not postal codes or changes made in production since Job 1 started.

3) Job 2. This copy has updated postal codes, but not birth dates or changes made in production since Job 2 started.

No matter which file gets copied back to production, all changes made in production will be lost. Then, when the other work file gets copied back to production, all of those changes will be lost too. The resulting production file will only contain changes made by the last batch program to update the work file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM