Hello,
I think that if that file is externally defined and that you have level checking on in your programs, that should make it easy and protect you. If the 2 programs are not at the same level (for the file definition), one of them will give you a level check error at run time.
Denis Robitaille
Directeur Service technique TI
CASCADES INC.
412 Marie Victorin
Kingsey falls(Québec) Canada J0A 1B0
T : 819 363-6130
F : 819 363-6155
"Koester, Michael" <mkoester@xxxxxxxxxxxxx> 2012-05-24 17:07 >>>
Thanks for that Denis.
I went for a walk at lunch and came up with that one as well, almost exactly as you described. Still might end up going that way. Downside is that I don't know how to automatically update the file format from the copybook, so that's another place where the definition needs to be adjusted. It is "easy", at least for the initial development, if not for maintenance.
-- Michael
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Denis Robitaille
Sent: Thursday, May 24, 2012 4:58 PM
To: i, RPG programming on the IBM i / System
Subject: RE: Passing data structure to batch job
I will give it a try to suggest something easy and that works in all circumstances:
Use a file for which the record definition is like the data structure mentioned plus one field that is the key (let's say a 15 digit number field). The short running program puts the values to pass to the long running program in a record in that file. Chooses whatever method you which to generate the key value (stored in a data area, position yourself on the last record and do a read previous ...). Now the short running program just pass the key value to the long running program et voila.
Just make sure that the long running program deletes the record when it is finished.
I know that using a file for parameter passing is not the most efficient way but we were ask for an "easy" way and this way is easy and will work even if there was several short running jobs calling several long running jobs.
Another advantage is that that way, you are sure that both the calling and called program use the same structure for the parameters (type, length, position ...).
So this is my 2 cents
Hope this help
Denis Robitaille
Directeur Service technique TI
CASCADES INC.
412 Marie Victorin
Kingsey falls(Québec) Canada J0A 1B0
T : 819 363-6130
F : 819 363-6155
--
As an Amazon Associate we earn from qualifying purchases.