S/36 RPG program using a Data Area

15 pts.
We enter in vouchers from a variety to locations. All of the voucher entry programs are written in RPG IV and use a Data Area to get the next voucher, update the data area using lock in/out. This all works very well.

We have an older S/36 program that populates Employee Expenses into the voucher system. (usually this process creates a few hundred vouchers)

Here's my problem: 1st the System 36 program can't use the data area. So I created a File and a quick program to lock in the data area and populate the file with the last voucher.  The problem is once I leave the quick program my data area is no longer locked (and this S/36 program could take up to 5 minutes to run) I can't have duplicate voucher numbers.

any suggestions

Software/Hardware used:
as400 s36 rpg II program data area

Answer Wiki

Thanks. We'll let you know when a new response is added.

In th S36 proc can you, before you call the RPG36 program, can you do an allocate object of the *Dtaara, then Release it after the program ends?
Or, in the quick program that you wrote, add an additional parm.
Then call it twice instead of just once.
The first time it does the Lock and the second time it does the release.

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • aceofdelts
    You could also create a 2nd data area for the S/36 pgms. Easiest if separate voucher number range. Else, your quick pgm locks the main dtaara and loads that value to the S/36 dtaara. The S/36 pgm just uses the 2nd data area naturally. At EOJ, it calls the quick pgm to update the main voucher # and unlock the main dtaara. This gets messy if you can have multiple S/36s doing this concurrently.
    2,550 pointsBadges:
  • Yorkshireman
    Use ALCOBJ the data area *EXCL before you call the 5360 procedure, and DLCOBJ the data area when it returns. or a variation on providing the lock - you may want to allow read access.
    6,085 pointsBadges:
  • Damsonfly
    Not sure how your programs are structured and at what point in time everything is happening. Here is another suggestion. a) Leave your quick program open i.e don't let it close with an end until other program finishes. This should keep it locked.unfortunately it means no one can get a new voucher number until the end. b) in the quick/sub Lock the data area. extract the last Vno, increment it and write new number immediately to the data area. Then pass the the new Vno via parameter to other pgms. Are there still S36's out there. I thought everyone had upgraded.
    10 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: