I have a service program with multiple procedures.
Two of the exported procedures have a parameter "REQUEST" that is like a template qualified data structure "T_REQUEST".
"T_REQUEST" is not global. Each procedure has it's own version of "T_REQUEST" that is different.
The PCML that is generated has two conflicting structs for "T_REQUEST".
Each "program" in the PCML points "REQUEST" to "T_REQUEST".
Because the system cannot determine which "T_REQUEST" to use it appears to always utilize the last one found in the PCML.
So, the request for one procedure works but the other does not because the parameters I pass don't map correctly.
My workaround is to name each template differently instead of using just "T_REQUEST" have it unique across the whole module; even though it should be a localized structure.
Submitting as RFE...may need to be a PMR...
Use Case: Create a service program with parameters that use likeds and then examine the PCML.
------
**FREE
ctl-opt nomain;
ctl-opt pgminfo(*pcml:*module);
dcl-proc refTestProcedure_one export;
dcl-pi *n;
request likeds(t_request) const;
http_status int(10);
result char(100);
end-pi;
dcl-ds t_request template qualified;
companyCode char(4);
userId char(10);
end-ds;
if request.companyCode = '01';
result = 'Ok';
http_status = 200;
else;
http_status = 204;
endif;
return;
end-proc;
dcl-proc rfeTestProcedure_two export;
dcl-pi *n;
request likeds(t_request) const;
http_status int(10);
result char(100);
end-pi;
dcl-ds t_request template qualified;
companyCode char(4);
userId char(10);
days int(10);
end-ds;
if request.companyCode = '01';
result = 'Ok';
http_status = 200;
else;
http_status = 204;
endif;
return;
end-proc;
---
PCML:
<pcml version="6.0">
<struct name="T_REQUEST">
<data name="COMPANYCODE" type="char" length="4" usage="inherit" />
<data name="USERID" type="char" length="10" usage="inherit" />
<data name="DAYS" type="int" length="4" precision="31" usage="inherit" />
</struct>
<struct name="T_REQUEST">
<data name="COMPANYCODE" type="char" length="4" usage="inherit" />
<data name="USERID" type="char" length="10" usage="inherit" />
</struct>
<program name="RFETESTPROCEDURE_TWO" entrypoint="RFETESTPROCEDURE_TWO">
<data name="REQUEST" type="struct" struct="T_REQUEST" usage="input" />
<data name="HTTP_STATUS" type="int" length="4" precision="31" usage="inputoutput" />
<data name="RESULT" type="char" length="100" usage="inputoutput" />
</program>
<program name="REFTESTPROCEDURE_ONE" entrypoint="REFTESTPROCEDURE_ONE">
<data name="REQUEST" type="struct" struct="T_REQUEST" usage="input" />
<data name="HTTP_STATUS" type="int" length="4" precision="31" usage="inputoutput" />
<data name="RESULT" type="char" length="100" usage="inputoutput" />
</program>
</pcml>
In 7.2 and above, RPG compiler ensures that structures in same source file that have same name but are defined differently are unique when generating the PCML,
In addition, the integrated web services server has been improved to ensure structures in different modules are unique and handled correctly. You will need the following IWS PTFs:
SI68894 V7R1M0
SI68864 V7R2M0
SI68865 V7R3M0
IBM agrees with the request and a solution appears to be desirable and feasible. IBM intends to provide a solution. However, IBM's plans may change and no commitment is made that a solution will be provided.
In the meantime, how this currently works is working as designed.