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


  • Subject: Re: AS400 Toolbox problems - ServiceProgramCall
  • From: "Dave Wall" <dawall@xxxxxxxxxx>
  • Date: Tue, 14 Aug 2001 09:44:41 -0500


Here is code to call entry point QtocLstNetIfc in service program
QTOCNETSTS.  The entry point takes three parameters -- two strings (passed
by reference) and the error code.  The strings are converted from Unicode
to EBCDIC before being sent to the server.  When calling programs or
service programs, pay particular attention to lengths.  The Toolbox client
passes data to the program call server who dumps the data in one big
buffer.  It then passes pointers to that buffer or pulls data out of the
buffer when calling the service program.  If a length is off the wrong data
will be passed, but since all data comes out of one big buffer you may not
get a addressing errors (trying to get to memory you don't own).  You will
just get bad data.

Are you trying to call an OS/400 service program or one of your own?  Some
Toolbox objects are implemented by calling OS/400 service programs via
ServiceProgramCall so I know it can work.

        AS400 system = new AS400();

        // The first parm is 20 characters, 10 chars of user space followed
by 10 chars of library.
        // Create a converter for 20 chars.
        AS400Text char20 = new AS400Text(20, system);

        // The second parm is the format name (8 chars).  Create a
converter.
        AS400Text char8  = new AS400Text(8, system);

        // Create program parameters
        ProgramParameter[] parms = new ProgramParameter[3];

        // First parm is qualified user space CHAR(20)
        //   CHAR(0-9) is the user space name
        //   CHAR(10-19) is the library name
        String qSpace = "DAW       DAW       ";

        // First parm is the library qualified UserSpace
        parms[0] = new ProgramParameter(char20.toBytes(qSpace));
        parms[0].setParameterType(ProgramParameter.PASS_BY_REFERENCE);

        // Second parm is the format
        parms[1] = new ProgramParameter(char8.toBytes("NIFC0100"));
        parms[1].setParameterType(ProgramParameter.PASS_BY_REFERENCE);

        // Last parm is the error code.  We pass an array of 0x00s so
messages are returned.
        byte[] bytes = new byte[32];
        parms[2] = new ProgramParameter(bytes, 32);
        parms[2].setParameterType(ProgramParameter.PASS_BY_REFERENCE);

        ServiceProgramCall sPGMCall = null;

        System.out.println("About to create the program");
        sPGMCall =  new ServiceProgramCall(system,
                                           "/QSYS.LIB/QTOCNETSTS.SRVPGM",
                                           "QtocLstNetIfc",

ServiceProgramCall.NO_RETURN_VALUE,
                                           parms);

        System.out.println(sPGMCall.run());

        AS400Message[] ml = sPGMCall.getMessageList();

        for (int i=0; i<ml.length; i++)
           System.out.println(ml[i].getID() + ": " + ml[i].getText());

David Wall
553-5329
AS/400 Toolbox for Java



                                                                                
                            
                    "Price, Chris"                                              
                            
                    <chris_price@nsb.c       To:     "'java400-l@midrange.com'" 
<java400-l@midrange.com>    
                    o.uk>                    cc:                                
                            
                    Sent by:                 Subject:     AS400 Toolbox 
problems - ServiceProgramCall       
                    owner-java400-l@mi                                          
                            
                    drange.com                                                  
                            
                                                                                
                            
                                                                                
                            
                    08/14/2001 05:31                                            
                            
                    AM                                                          
                            
                    Please respond to                                           
                            
                    JAVA400-L                                                   
                            
                                                                                
                            
                                                                                
                            




Has anyone successfully managed to call a procedure in a service program,
using the ServiceProgramCall class?

I'm having major problems getting this to work:

Passing by reference doesn't work at all - get null pointer errors in the
procedure.

Passing by value works for integers, but Strings get garbled. I thought
this
might be a CCSID problem, but the same code works fine for a ProgramCall.

Does anyone have any working examples using this class, there aren't any
that I can find in the toolbox documentation.

Confused,
Chris.




=======DISCLAIMER=======
This email transmission and any attachments may contain confidential
information which is legally privileged.  You are also notified that the
contents of this email and any which you may send in reply, may be viewed
by
authorised personnel on behalf of NSB Retail Systems Plc or its
subsidiaries
(the Company) in accordance with the Company's Information Access Policy.
The content of this email is always subject to contract.  The information
is
intended only for the individual or entities to whom it is addressed.  If
you are not an intended recipient please contact me immediately and you are
hereby notified that any disclosure, copying, distribution, storage on any
medium or use of the information contained in this transmission is strictly
prohibited.

+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---




+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.