Chuck,
You may well be in line for the extra points. I may need some help getting the syntax right for setting up the sbmjob command, but if it works, I like that solution for several reasons:
1) easy (given my lack of expertise in data queues, user spaces, API's that I'm not yet familiar with)
2) as I add stuff to my data structure as the design matures, I can maintain that in a copybook, and the sbmjob doesn't care
3) it's maintainable by the small shop with limited knowledge
4) it's not LDA (for you, Jon)
The syntax issue I'm running into when setting up a test, is the sqlrpgle submitting program doesn't pass the sql precompiler because the ds "is not defined or usable" (SQL0312)
The ds is defined in the test program (not /copied yet) as follows:
d NMS_OrderDetails...
d ds qualified
d Order 6a
d OrderType 2a
d Phone# 10S 0 inz(0)
d PhoneExch 6s 0 overlay(Phone# : 1)
d PhoneLine 4s 0 overlay(Phone# : *next)
d OldPh# 10s 0 inz(0)
d OldExch 6s 0 overlay(OldPh# : 1)
d OldLine 4s 0 overlay(OldPh# : *next)
d CableType 6 inz
d PriorCableType...
d 6 inz
d COE 11a inz
I define some stand-alones:
d Command s 200a varying
d ParmInHex s 512a varying
I have some code that loads some data into the subfields, and then:
exec sql
set ParmInHex = 'X''' CONCAT HEX(:NMS_OrderDetails) CONCAT '''';
Command = 'SBMJOB CMD(CALL PGM(PROVSN_NMS) PARM(''ParmInHex''))'
+ ' JOB(NMS) JOBQ(QBATCH4)';
Precompiler doesn't like :NMS_OrderDetails. Don't know why. If someone sees my trouble, I'd appreciate the clue.
After I solve that we'll see if I got Command created correctly.
By the way, I'll be here until 6 PM Eastern(US) today, then gone until Tuesday. Don't take offense if my response is delayed because of that.
~~~~~~~~~~~~~~
To all the others who offered ideas, and efforts spent in explaining, many thanks. I intend to explore many of those ideas for future use, or sooner if this solution fails me.
-- Michael
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Thursday, May 24, 2012 1:23 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Passing data structure to batch job
On 24 May 2012 05:39, Koester, Michael wrote:
Never tried this before: I have a SQLRPGLE program running in batch
that needs to submit another program to batch and pass a data
structure to that new job. <<SNIP>> I normally use a call to QCMDEXC
to launch (via SBMJOB) such a job from RPG, but my question is more
about passing a data structure ( like I'd do in a prototyped call ).
<<SNIP>> (Extra points to a response that say's "it's easy") Thanks.
If easy enough to do as "normally" to build the command string, then the following should be almost as easy:
Use the expression 'X''' CONCAT HEX(:DS) CONCAT '''' as the data for the parameter [within PARM()] in the CALL command string that is built.
If there is some restriction on use of :DS, then define a based character variable for the length of the DS, thn use that :variable after setting the basing pointer to the address of the DS variable.
Regards, Chuck
--
As an Amazon Associate we earn from qualifying purchases.