× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You are correct that a user space has to have a unique name like any other object.

Now if you want an object that has a single name but isn't a data file but you can update/delete/add to then you might want to investigate user indexes. They too are very handy. The user index APIs can be found under the Object APIs at the InfoCenter.

Gary Monnier

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jerry C. Adams
Sent: Thursday, May 24, 2012 12:31 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Passing data structure to batch job

I'm probably putting my foot in my mouth (done that before), but an issue that I have with User Spaces and Data Areas when passing data down the line is that they either have to have a unique name -or- you have to pass the name to reference down the line (via the LDA? More probably as a parameter,
though.). I use both frequently, though data areas more often. And
they're great for "Last Invoice # used" and such. But in a multi-user environment I have a problem (true, probably a personal issue) using USs and DAs to pass actual data down the line; otherwise, user A can step all over user B's data.

Jerry C. Adams
IBM i Programmer/Analyst
Money is better than poverty, if only for financial reasons. -Woody Allen
--
A&K Wholesale
Murfreesboro, TN
615-867-5070


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Monnier, Gary
Sent: Thursday, May 24, 2012 2:19 PM
To: RPG programming on the IBM i / System i
Subject: RE: Passing data structure to batch job

Michael,

Consider using a user space. A user space can be looked at as a 16MB white board. With pointers available in ILE RPG and CL you can essentially create a shared memory cache. Set a value in one program and viola! It shows up in the other program. Very handy for job to job communications.

In the ILE RPG program (program A) create your data structure as being based to a pointer

D cacheptr S *

D cacheData DS based(cacheptr)
D field1 15A
D field2 2000A
D field3 10I 0

Use the Retrieve Pointer to User Space (QUSPTRUS) API to load cacheData.
Your pointer for QUSPTRUS is cacheptr.

Now set the subfields in cacheData as suits your needs and submit your other program. If it is an ILE RPG define the data structure again and obtain the pointer to it. The data structure will be populated with what program A's values.

If your second program is a CL, use something like this...

DCL VAR(&CACHEPTR) TYPE(*PTR)
DCL VAR(&CACHEDATA) TYPE(*CHAR) STG(*BASED) BASPTR(&CACHEPTR)
DCL VAR(&FIELD1) TYPE(*CHAR) STG(*DEFINED) LEN(15) DEFVAR(&CACHEDATA 1)

DCL VAR(&FIELD2) TYPE(*CHAR) STG(*DEFINED) LEN(2000) DEFVAR(&CACHEDATA 16)

DCL VAR(&FIELD3) TYPE(*INT) STG(*DEFINED) DEFVAR(&CACHEDATA 2001)

Again use the Retrieve Pointer to User Space (QUSPTRUS) API to load &cacheData. Your pointer for QUSPTRUS is &cacheptr.

HTH.

Gary Monnier

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Koester, Michael
Sent: Thursday, May 24, 2012 5:39 AM
To: RPG400-L@xxxxxxxxxxxx
Subject: Passing data structure to batch job

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. The original job executes in just a few seconds, the new job executes calls to web services that take maybe 45 seconds each to return results, so I'm reluctant to burden the original job with that kind of wait.
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 ). Is a data queue required here? ...I have no experience with those.
(Extra points to a response that say's "it's easy") Thanks.

Michael Koester

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.