Error calling program. Code: UNEXPECTED Msg: XML run loop fa

ffleer
Posts: 17
Joined: Tue Jan 31, 2012 10:44 am

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by ffleer » Tue May 14, 2013 3:55 pm

Sorry but I have been away for two weeks.

I get the following:

system -i "dspsrvpgm srvpgm(qgpl/srvpgm01) detail(*PROCEXP)" | grep -i w
OWNER . . . . . . . . . . . . . . . . . : GRPOPS
WACHT *NO

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Tue May 14, 2013 9:38 pm

Function/procedure/routine is a case sensitive look-up (name/lib are not) ...

Code: Select all

<func before='819/37' after='37/819' hex='on'>7761636874</func>
0x7761636874 == "wacht" <-- error wrong case 
0x5741434854 == "WACHT"  <--- you appear to need UPPER case

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Tue May 14, 2013 9:59 pm

BTW -- before you ask ... detail(*PROCEXP) report is accurate (see below) ... your function name really is UPPER CASE "WACHT"

Code: Select all

> system -i "dspsrvpgm srvpgm(qsys/qp2user) detail(*PROCEXP)"
                                                         Procedure Exports:
 Procedure Name                                                             ARGOPT
 Qp2RunPase                                                                 *NO
 Qp2CallPase                                                                *NO
 Qp2SignalPase                                                              *NO
 Qp2CallPase2                                                               *NO
 __Qp2init                                                                  *NO
:

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Thu May 16, 2013 7:13 pm

Addiotnal info for those reading this forum post ...

>>> ... procedure (*MODULE) must be already bound into a *pgm or *srvpgm object in order to be able to call it from PHP via the toolkit.
Correct.

http://publib.boulder.ibm.com/iseries/v ... 606605.htm
A module object is a nonrunnable object that is the output of an ILE compiler. A module object is represented to the system by the symbol *MODULE. A module object is the basic building block for creating runnable ILE objects. This is a significant difference between ILE and OPM. The output of an OPM compiler is a runnable program.

more ...
http://publib.boulder.ibm.com/iseries/v ... 606608.htm

ffleer
Posts: 17
Joined: Tue Jan 31, 2012 10:44 am

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by ffleer » Fri May 17, 2013 9:25 am

Aaaaaaahhh you are right! My procedure name is in uppercase. The thing is I'm so used to lowercase procedure names but when I created this small service program I did not bother to create the binder source. As a result during compilation my procedure names were converted to uppercase. Thx for your feedback.

Now I have 2 more strange issues:

1. My "WACHT" subprocedure simply runs a DLYJOB. Initially it waited 66 seconds but then I changed this to 11 seconds. When I run my PHP script in 'stateless'=>'true' mode it waits 11 seconds. If I run my PHP program in 'InternalKey' mode it waits 66 seconds, it keeps picking up the old compiled version of the service program, even 1 day later. Why is this? The service program has been compiled to run in it's own activation group PHP but changing this to *CALLER does not have to seem any effect.

2. I have another (existing) RPG subprocedure that expects two input parameters. This runs for years and works ok but when called from PHP it's behavior is different. I noticed this when debugging the subprocedure. The subprocedure does receive the 2 parameters (I can see the values in debug). The following IF-code is NOT executed when called from PHP but it is when called from CL and/or RPG. So either %parms is not right or %addr is null ?!?!?

Code: Select all

       if %parms >= 1 and %addr(arg_usrprf) <> *null;                                               
          arg.usrprf = uppercase(arg_usrprf);                                                       
       endif;                                                                                       
       if %parms >= 2 and %addr(arg_control) <> *null;                                              
          arg.control = uppercase(arg_control);                                                     
       endif;                                                              

aseiden
Posts: 874
Joined: Thu Apr 09, 2009 5:45 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by aseiden » Mon May 20, 2013 8:09 am

Frank,

I can answer question #1. End the XTOOLKIT job *IMMED. In stateful mode (InternalKey used), the XTOOLKIT jobs stays running, so your recompiled program keeps an older copy in QRPLOBJ, which will be used till the toolkit job is ended.

Not sure about #2. Any more information you can provide?

Alan

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Mon May 20, 2013 4:24 pm

Short answer ... %parms does not work PHP toolkit ...

Longer answer ... no help, but here is why (subsistute PHP tookit for Java) ...

RPG depends on an operational descriptor to get the %PARMS value. RPG
doesn't pass a _full_ operational descriptor unless OPDESC is coded, but
it always passes a mini operational descriptor, which gives it the
number of parameters.

When you call RPG from other languages, you have to make sure they pass
the operational descriptor. CLLE always passes a full descriptor, but
you have to tell C and COBOL to pass one.

Unfortunately, RPG can't always tell that it didn't get an operational
descriptor, so it might give you garbage for %PARMS rather than the -1
value it gives when it knows it didn't get the descriptor.

Even more unfortunately, there's no way to ask Java to pass an
operational descriptor. If you still want the *NOPASS function for your
non-Java callers, you'll have to create another procedure for Java to
call, maybe with some special "parameter-not-passed" value, or maybe
with an extra (first) parameter giving the number of other parameters.
Then your other procedure can call through to your real procedure:
if numparms = 2
callp otherproc(p1 : p2)
else

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Mon May 20, 2013 4:37 pm

However,
good news ... less popular *OMIT does work for raw XMLSERVICE (below)
bad news ... but i don't think that Alan enabled OMIT in PHP Toolkit

Code: Select all

$clob = <<<ENDPROC
<?xml version='1.0'?>
<script>
<pgm name='ZZSRV' lib='xyzlibxmlservicexyz' func='ZZOMIT'>
 <parm comment='my name' io='omit'>
  <data var='myName' type='10A'>Ranger</data>
 </parm>
 <parm comment='your name' io='in'>
  <data var='yourName' type='10A'>Vlad</data>
 </parm>
 <return>
  <data var='myReturnName' type='50A' varying='on'>Mud</data>
 </return>
</pgm>
</script>
ENDPROC;

Code: Select all


      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
      * zzomit: check omit 
      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     P zzomit          B                   export
     D zzomit          PI            50A   varying
     D  myName                       10A   options(*OMIT)
     D  yourName                     10A
      * vars
     D tmp             S             50A   varying
      /free
       tmp = 'my name is ';
       if %addr(myName) <> *NULL;
         tmp = tmp + %trim(myName) + ' ' + %trim(yourName);
       else;
         tmp = tmp + 'OMIT ' + %trim(yourName);
       endif;
       return tmp;
      /end-free
     P                 E


ffleer
Posts: 17
Joined: Tue Jan 31, 2012 10:44 am

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by ffleer » Tue May 21, 2013 2:50 pm

Thank you for your feedback on the 2 "strange issues".

I guess restarting the XTOOLKIT server job is not too much of a problem after a recompile but not so sure about %PARMS which is part of every service program we have. Even most "normal" (ILE) RPG programs use this function a lot.
Do I understand you correctly if I say the OPDESC keyword and CEEDOD are NOT an alternative solution in my service program because PHP does not pass this info?

rangercairns
Posts: 222
Joined: Fri Jul 24, 2009 6:28 pm

Re: Error calling program. Code: UNEXPECTED Msg: XML run loo

Post by rangercairns » Tue May 21, 2013 10:03 pm

>>> I guess restarting the XTOOLKIT server job is not too much of a problem after a recompile ...
Cool. Restart jobs is price we pay for ILE activation groups and associated reference counting of running/active programs (acive jobs) ... cough ... you really don't want ILE activation to work any other way as chaos would ensue (think about it for a moment)

>>> ... %PARMS which is part of every service
Again, %parms does not work from php toolkit ... maybe never will.
PASE _ILECALL extra pointer needed to "create-a-fake-full/mini-descriptor" is not available in API (_ilecall used by xmlservice).

>>> ... OPDESC keyword and CEEDOD ...
These just technical information for ILE intra-language play time (Uf Da), not a hint for work around for %parms php toolkit (perhaps too much information).

>>> ... PHP toolkit workaround for %parms ...
The ONLY workaround php toolkit %parms requires you do something ... most often this is simply adding additional export routine signatures that simply turn around and call your routine needing %parms ... or my favorite using *OMIT (if Alan supports *OMIT someday) ...

Code: Select all

     P zzomit          B                   export
     D zzomit          PI            50A   varying
     D  aName                        10A
     D  myName                       10A   options(*OMIT)
     D  yourName                     10A   options(*OMIT)
... check *NULL and call %parms routine with non-NULL nbr parms ...
return parmsMe(aName:myName);
... both non-NULL ...
return parmsMe(aName:myName:yourName);

Post Reply