× 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.



Let me reiterate stuff that I've learned on my journey.
Stop thinking of a sql variable as a sql variable. Think of them instead in the terms of an RPG variable. This RPG variable is in a service program called MYSRVPGM. And the MYSRVPGM is set with
Activation group attribute . . . . . . . . . . . : *CALLER
Shared activation group . . . . . . . . . . . . : *
So, when you run the following in SQL
SET MYLIB.MYSRVPGM = 'HRSHIPPEDD';
It basically calls MYSRVPGM with that as a parameter and it stores that into an appropriate RPG variable.
When you run the following
VALUES MYLIB.MYSRVPGM;
It calls MYSRVPGM and retrieves the content of that variable.

However if you use the SET from something running in one activation group, and you use the VALUES from something running in a different activation group, you are going to run into issues. Basically what will happen is that VALUES will return a null variable.
This is exactly what is happening.

Yes, you can rewrite this to stop using sql variables.
Then again, you can stop trying to duct tape SQL into CL and just use a different language, one that can do SET, retrieves, etc all in the same activation group.

I come from a slightly different background. I was pretty adept at CL. Then, back when it was languishing way behind and had no structured programming operations, etc I abandoned it. I abandoned it to the extreme. Even for "system" type programs I would use RPG with QCMDEXC or some of the better API's for calling commands. So, if I had to write something which needed to use SQL and system commands even today I would not write it in CL but I would write it in RPG.

Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.