Am 12.05.2022 um 17:45 schrieb smith5646midrange@xxxxxxxxx:
Apologies in advance that this email is so long. I'm just trying to provide all of the detail in one shot.
I have two *PGMs and a *SRVPGM with SQL that are acting weird and I’ve exhausted my knowledge for possible causes. Both PGMs are created with activation group *NEW and the SRVPGM is create with activation group *CALLER.
The one oddity is the file that I am fighting with (SCFCONFIG) is an alias (DDMF) pointing to another machine. This is the command on machine MIDOHIO2 that created the alias. Note that the PF that is points to is on MIDOHIO.
CREATE ALIAS $SCAMS/SCFCONFIG FOR MIDOHIO.$SCAMS.SCFCONFIG; I am
trying to use the alias / DDMF route because the machine that the PF is on will vary because there are two different “host systems” and building SQL strings with variables and then preparing them got to be a royal pain.
The below process is being executed on MIDOHIO2.
Program 1 calls function RetrieveConfigValue in the SRVPGM with a parm of ‘JobQ’.
jobq = RetrieveConfigValue('JobQ'); This properly returns a value
of ‘*INTERACT’ (i.e. not running in batch mode).
Because it is interactive, Program 1 now calls Program 2.
Program 2 calls function RetrieveConfigValue in the SRVPGM with a parm of ‘JobQ’.
jobq = RetrieveConfigValue('JobQ'); This now returns a value of
blanks. Note that the call and parm are identical.
Here is the function.
dcl-proc RetrieveConfigValue export;
dcl-pi *n char(500);
@key char(10) const;
dcl-s rtnValue char(500);
where key = :@key;
The only differences in the SQLCA are shown below. The top line is the successful call. The bottom line is the failed call. The results are the reverse of what I would expect to see. :(
SQLERRP OF SQLCA = 'QSQFETCH'
SQLERRP OF SQLCA = ' '
SQLERP OF SQLCA = 'QSQFETCH'
SQLERP OF SQLCA = ' '
SQLERRD OF SQLCA(3) = 1
SQLERRD OF SQLCA(3) = 0
SQLERRD OF SQLCA(4) = 500
SQLERRD OF SQLCA(4) = 0
SQLERRD OF SQLCA(5) = 100
SQLERRD OF SQLCA(5) = 0
SQLERRD OF SQLCA(6) = -134613260
SQLERRD OF SQLCA(6) = 0
SQLERR OF SQLCA = ' █ █4 À7964'
SQLERR OF SQLCA = ' '
SQLER3 OF SQLCA = 000000001.
SQLER3 OF SQLCA = 000000000.
SQLER4 OF SQLCA = 000000500.
SQLER4 OF SQLCA = 000000000.
SQLER5 OF SQLCA = 000000100.
SQLER5 OF SQLCA = 000000000.
SQLER6 OF SQLCA = -134613260.
SQLER6 OF SQLCA = 000000000.
When I debug the process and stop it at the point where the second execution of the sql returns blanks and use STRSQL, I get ‘*INTERACT’ as expected.
If I change SCFCONFIG to be a PF on MIDOHIO2, both calls to RetrieveConfigValue return ‘*INTERACT’.
Also, if I change the SQL to hardcode the machine and library like this, it also works the first time but not the second.
where key = :@key;
I am so confused!!!!
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.