PgmCall errors when calling cobol program

PgmCall errors when calling cobol program

Postby chrispaske on Thu Mar 15, 2012 11:00 pm

I'm working on migrating from the old i5 toolkit to the XMLSERVICE implementation. When attempting to call a cobol program using PgmCall with parameters, my zendsvr process hangs. I have to restart web server to recover.
I was able to recover the following from the debug log:
Code: Select all
Input XML: <?xml version="1.0" encoding="ISO-8859-1" ?><script>
<pgm name='A4MNTR99' lib='TESTLIB'>
<parm comment='ProgramName' io='both'>
   <data type='10A' var='CALL-KEY' >TESTRECORD</data> 
</parm>
<parm comment='NextNumber' io='both'>
   <data type='8A' var='CALL-NEXT-NUMBER' >INIT</data> 
</parm>
<parm comment='ReturnMessage' io='both'>
   <data type='80A' var='CALL-RETURN-MESSAGE' >INIT</data> 
</parm>
</pgm>
</script>

Nothing else is logged after this and the process hangs.

So I created a program with no parameters and am attempting to call it to simplify things. In this case the request returns with failure. The debug log has the following message:
Code: Select all
Message . . . . :   Total parameters passed does not match number required.
Cause . . . . . :   Program &2 attempted to call program A4MNTRXX with 8192
parameters. Program A4MNTRXX expects a minimum of 0 and a maximum of 0
parameters. Recovery  . . . :   Use the Display Program (DSPPGM) command to
determine the correct number of parameters to pass.]]>


My call is as follows:
Code: Select all
$result = $ToolkitServiceObj->PgmCall("A4MNTRXX", "TESTLIB");


Environment: v5r4, ZendServer 5.6

Any guidance is appreciated.

- Chris
chrispaske
 
Posts: 5
Joined: Thu Mar 15, 2012 10:39 pm

Re: PgmCall errors when calling cobol program

Postby aseiden on Fri Mar 16, 2012 3:33 am

Hi, Chris,

First, regarding your first "hang" test, is there any message waiting with DSPMSG QSYSOPR?

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

Re: PgmCall errors when calling cobol program

Postby chrispaske on Fri Mar 16, 2012 3:08 pm

Alan,

There was a message waiting. The program is throwing a MCH3602: Pointer type not valid for requested operation. I have isolated it to a line that attempts to move spaces to one of the passed variables. After more testing, it throws that exception anytime the program attempts to use any of the passed variables.

Here is the param signature.
Code: Select all
LINKAGE SECTION.                             
01 CALL-PROGRAM        PIC X(10).             
01 CALL-NEXT-NUMBER    PIC 9(8).             
01 CALL-RETURN-MESSAGE PIC X(80).             
                                             
**********************************************
                       PROCEDURE DIVISION     
**********************************************
PROCEDURE DIVISION USING CALL-PROGRAM,       
                         CALL-NEXT-NUMBER,   
                         CALL-RETURN-MESSAGE.

    MOVE SPACES TO CALL-RETURN-MESSAGE.       


The error occurs on the last line of code above.

I'm calling with the following:
Code: Select all
   $objectName = "TESTRECORD";
   $retVal = "INIT";
   $retMsg = "INIT";
   $param[] = $ToolkitServiceObj->AddParameterChar('both', 10, 'ProgramName', 'CALL-PROGRAM',   $objectName);
   $param[] = $ToolkitServiceObj->AddParameterChar('both', 8, 'NextNumber', 'CALL-NEXT-NUMBER', $retVal);
   $param[] = $ToolkitServiceObj->AddParameterChar('both', 80, 'ReturnMessage', 'CALL-RETURN-MESSAGE', $retMsg);
   $result = $ToolkitServiceObj->PgmCall("A4MNTRXX", "TESTLIB", $param, null, null);


- Chris
chrispaske
 
Posts: 5
Joined: Thu Mar 15, 2012 10:39 pm

Re: PgmCall errors when calling cobol program

Postby chrispaske on Fri Mar 16, 2012 4:31 pm

SOLVED:
After doing a dump on the MCH3602 error, a message showed up in the debug.log file that mentioned teraspace was not enabled. The program I was calling was OPM. I changed the OPM program to enable teraspace then received the following:
Code: Select all
MCH3402    Escape                  40   03/16/12  09:41:09.359008  < allProgram             00005C   QP2USER2    QSYS        *STMT
                                     From Program  . . . . . . . :   AiUpcallProgram
                                     To module . . . . . . . . . :   QP2API
                                     To procedure  . . . . . . . :   runpase_common__FiPvT2
                                     Statement . . . . . . . . . :   2
                                     Message . . . . :   Tried to refer to all or part of an object that no longer
                                       exists.
                                     Cause . . . . . :   The most common cause is that a stored address to an
                                       object is no longer correct because that object was deleted or part of the
                                       object was deleted.]]>


I went ahead and recompiled the cobol program as ILE and all seems to be working correctly now.

Thanks for you help.

- Chris
chrispaske
 
Posts: 5
Joined: Thu Mar 15, 2012 10:39 pm

Re: PgmCall errors when calling cobol program

Postby aseiden on Fri Mar 16, 2012 7:06 pm

Good work, Chris.

I have good news...we're testing an update that will allow OPM to work on v5r4 as well.

If you are interested in testing the update, please let me know.

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

Re: PgmCall errors when calling cobol program

Postby aseiden on Thu May 24, 2012 6:44 pm

If you plan to call OPM (non-ILE) programs on v5r4, first do these three steps:

1. Install the latest XMLSERVICE (1.6.8 or higher). It's currently "experimental." You can get it here:
http://174.79.32.155/wiki/index.php/XML ... ICETesting

It will probably also be included in PTF "12-06" (estimated late June/ early July)

2. Install the latest PHP toolkit (CW/TK), 1.2.4 or higher from http://www.youngiprofessionals.com/wiki/XMLSERVICE

3. In toolkit.ini, under the [system] section, set v5r4=true:
Code: Select all
[system]
v5r4=true
--or--
in your PHP code, as needed:
Code: Select all
$conn->setToolkitServiceParams(array('v5r4'=>true));
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm

Re: PgmCall errors when calling cobol program

Postby aseiden on Thu May 24, 2012 7:23 pm

Of course, you can also recompile your programs as CLLE instead of CLP, or RPGLE instead of RPG. Or get off of v5r4, as many shops are doing. v7.1 is a great release, highly recommended.

But you can use our v5r4=true technique till then.
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm


Return to New Toolkit

Who is online

Users browsing this forum: No registered users and 2 guests