[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: RPG Array's - Please Help



   Giel,
   Depending on the release level of your System i you may consider to use
   a stored procedure to call your RPG programs. From my point of view
   that is a lot easier than using PCML.
   The only drawback I know is that you cannot pass a result set (= an
   array) to a RPG program unless your are on V7R1 or higher. I assume you
   do not really want to use the SQL Call Level Interface for that, right?
   But if you were familiar with the SQL CLI API, you could even do that.
   The attached sample program demonstrates how to use stored procedures
   to enable RPG for Java (SQL). "rtvsyssts.rpgle" is a RPG service
   program. The commands to create the object are at the top of the source
   member. Right below are the commands to create the required stored
   procedures.
   "SystemStatusService.java" actually is a Java class that I deployed on
   a Tomcat server to act as a web service. Methode
   "retrievePoolStatusInformation" calls RPG procedure
   "RetrieveSystemStatus_poolInformation", which returns a RPG array as a
   result set to the Java class. The number of items to be returned is
   specified in "numRows" like this:
      EXEC SQL
       SET RESULT SETS FOR RETURN TO CALLER ARRAY :poolInfo
                                              FOR :numRows ROWS;
   "datatypes" is another example that echos different data types.
   I personally like the idea to use a result set to return values from
   RPG to Java. I use it all the time even if there is only a single row
   to return. That makes it easy to add return values to the result set
   but to change the Java class later on.
   The example was taken from a speech I held on the German Common
   conference back in 2009. You may use it the way you like it.
   Regards,
   Thomas.
   ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx schrieb am 10.10.2012 08:48:35:
   > Von: Giel.vanderMerwe@xxxxxxxxxx
   > An: ftpapi@xxxxxxxxxxxxxxxxxxxxxx,
   > Datum: 10.10.2012 09:11
   > Betreff: RE: RPG Array's - Please Help
   > Gesendet von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   >
   > Yip I use a RPG program with an array to pass driver information to
   > an outside company, being more than one driver there is more than
   > one record, my initial thinking was to use the array as an output to
   > pass the information so that the info can be passed in one single
   > call, in my rpgle program I specify the array as DIM(100).
   >
   > My rpgle program then uses a pcml file, the complaint I had in doing
   > this was that let's say there is only one driver change, the data
   > the outside company receives will have 1 record with data and 99
   > records with none,
   > And not being an rpg specialist I have not been able to change my
   > rpg program to have a variable in the DIM(VARIABLE),
   >
   > Now reading up on this it seems there is a way of doing it with the
   > pcml file, but this I have also not been able to get working
   >
   > Giel
   >
   > -----Original Message-----
   > From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [[1]mailto:ftpapi-
   > bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Alan Campin
   > Sent: 10 October 2012 07:07 AM
   > To: HTTPAPI and FTPAPI Projects
   > Subject: Re: RPG Array's - Please Help
   >
   > I would be happy to send it to but based on what I have seen of this
   > thread, I don't think that is what you are looking for.
   >
   > As I understand this you have a web service written in Java that
   > wants to call a program on the AS/400. Is that correct?
   >
   > If yes, you are using PCML to build the call to the AS/400 programs
   > and you want to pass arrays of data to the AS/400?
   >
   > First of all, let me say that I don't believe in using PCML to pass
   > array or other information to the AS/400. It just gets too
   complicated.
   >
   > What I have done at my present company is to abstract the interface
   > away but that is probably too complex for you.
   >
   > What I would suggest is to use XML. Just build an XML string with
   > your data and pass all the requests that way so that interface is
   > always the same.
   >
   > In the receiving AS/400 you just receive a single varchar string (a
   > Varying Character field) say 32K in size. In your receiving program,
   > you just use EXPAT, or SAX or XML-INTO to parse the XML and process.
   > Using this method, you can pass any kind of data no matter how
   > complex. The sending program and receiving programs just have to
   > agree on what the XML looks like.
   >
   > All this assumes that I have understood you situation correctly.
   > Have I understand the problem?
   >
   > On Tue, Oct 9, 2012 at 9:50 PM, Giel van der Merwe <
   > Giel.vanderMerwe@xxxxxxxxxx> wrote:
   >
   > >    Hi there alan, could I impose and ask if you can send me the
   demo
   > >    program,
   > >    I am still finding it hard to get rid of the redundant data as
   seen
   > >    below(notice the blank data records):
   > >    aubaxfrResponse
   > >    return
   > >    _P0RTN (string):
   > >    _YM01
   > >    _WDCAN2 (decimal): 0
   > >    _WDCIN2 (decimal): 0
   > >    _WDDGTX (string):
   > >    _WDF0NB (decimal): 0
   > >    _YM01
   > >    _WDCAN2 (decimal): 0
   > >    _WDCIN2 (decimal): 0
   > >    _WDDGTX (string):
   > >    _WDF0NB (decimal): 0
   > >    .
   > >    .
   > >    .
   > >    .
   > >    .
   > >    -----Original Message-----
   > >    From: [1]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > >    [[2]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
   Alan Campin
   > >    Sent: 08 October 2012 05:02 PM
   > >    To: HTTPAPI and FTPAPI Projects
   > >    Subject: RE: RPG Array's - Please Help
   > >    Are you needing a dynamic array? Not clear what you are asking.
   I have
   > >    a demo program that shows how to create dynamic arrays if you
   are
   > >    interested.
   > >    -----Original Message-----
   > >    From: [2]ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > >    [[3]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of
   Giel van
   > >    der Merwe
   > >    Sent: Monday, October 08, 2012 8:45 AM
   > >    To: [3]ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   > >    Subject: RPG Array's - Please Help
   > >    I am using a RPG program with an array to pass information out
   via a
   > >    web service deployed on my AS400, but I don't have the now-how
   to make
   > >    the array flexible, because right now I specify the array with
   200
   > >    records, when the web service runs, it creates 200 records
   although
   > >    there might only be data in the first 2 records.
   > >    Any advice or where I can start looking for - how to do
   > >    Giel van der Merwe
   > >
   #######################################################################
   > >    ##############
   > >    The provisions of Sections 11,12, and 13 of the Electronic
   > >    Communications and Transactions Act, 25 of 2002, in so far as
   > >    e-contracting is concerned is expressly excluded and contracted
   out by
   > >    Barloworld South Africa (Pty) Ltd ("Barloworld") and no data
   message or
   > >    electronic communication will be recognised as having legal
   contractual
   > >    status as per the aforementioned provisions under any
   circumstances.
   > >    All contracts concluded by Barloworld, its Business Units,
   Divisions
   > >    and Subsidiaries will only be legally binding and recognised
   once
   > >    reduced to physical writing and physically signed by a duly
   authorised
   > >    representative of Barloworld.
   > >    All other provisions of the Electronic Communications and
   Transactions
   > >    Act, 25 of 2002 are accepted.
   > >
   #######################################################################
   > >    ##############
   > >    Note:
   > >    This message is for the named person's use only. It may contain
   > >    confidential, proprietary or legally privileged information. No
   > >    confidentiality or privilege is waived or lost by any
   mistransmission.
   > >    If you receive this message in error, please immediately delete
   it and
   > >    all copies of it from your system, destroy any hard copies of it
   and
   > >    notify the sender. You must not, directly or indirectly, use,
   disclose,
   > >    distribute, print, or copy any part of this message if you are
   not the
   > >    intended recipient. Avis and any of its subsidiaries each
   reserve the
   > >    right to monitor all e-mail communications through its networks.
   > >    Any views expressed in this message are those of the individual
   sender,
   > >    except where the message states otherwise and the sender is
   authorized
   > >    to state them to be the views of any such entity.
   > >    Thank You.
   > >
   #######################################################################
   > >    ##############
   > >    -----
   > >    No virus found in this message.
   > >    Checked by AVG - [4][4]www.avg.com
   > >    Version: 2013.0.2677 / Virus Database: 2591/5812 - Release Date:
   > >    10/05/12
   > >
   -----------------------------------------------------------------------
   > >    This is the FTPAPI mailing list. To unsubscribe, please go to:
   > >    [5][5]http://www.scottklement.com/mailman/listinfo/ftpapi
   > >
   > >
   ----------------------------------------------------------------------
   > > -
   > >
   > >    [6][[6]cid:112101005501801501@mail41.mimecast.co.za]
   > >
   > >
   ______________________________________________________________________
   > > _
   > >
   > >    The provisions of Sections 11,12, and 13 of the Electronic
   > >    Communications and Transactions Act, 25 of 2002, in so far as
   > >    e-contracting is concerned is expressly excluded and contracted
   out by
   > >    Barloworld South Africa (Pty) Ltd ("Barloworld") and no data
   message or
   > >    electronic communication will be recognised as having legal
   contractual
   > >    status as per the aforementioned provisions under any
   circumstances.
   > >    All contracts concluded by Barloworld, its Business Units,
   Divisions
   > >    and Subsidiaries will only be legally binding and recognised
   once
   > >    reduced to physical writing and physically signed by a duly
   authorised
   > >    representative of Barloworld.
   > >
   > >    All other provisions of the Electronic Communications and
   Transactions
   > >    Act, 25 of 2002 are accepted.
   > >
   > >
   ______________________________________________________________________
   > > _
   > >
   > >     Note:This message is for the named person's use only.  It may
   contain
   > >       confidential, proprietary or legally privileged information.
    No
   > >    confidentiality or privilege is waived or lost by any
   mistransmission.
   > >    If you receive this message in error, please immediately delete
   it and
   > >     all copies of it from your system, destroy any hard copies of
   it and
   > >        notify the sender.  You must not, directly or indirectly,
   use,
   > >     disclose, distribute, print, or copy any part of this message
   if you
   > >     are not the intended recipient. Avis and any of its
   subsidiaries each
   > >      reserve the right to monitor all e-mail communications through
   its
   > >         networks.Any views expressed in this message are those of
   the
   > >     individual sender, except where the message states otherwise
   and the
   > >    sender is authorized to state them to be the views of any such
   entity.
   > >                                   Thank You.
   > >
   > >
   ______________________________________________________________________
   > > _
   > >
   > > References
   > >
   > >    1. [7]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > >    2. [8]mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   > >    3. [9]mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
   > >    4. [10]http://www.avg.com/
   > >    5. [11]http://www.scottklement.com/mailman/listinfo/ftpapi
   > >    6.
   > >
   [12]https://mail41.mimecast.co.za/mimecast/click?account=CSA20A3&code=b
   58e
   > > 4302dc89bd4ab414ff4cbf07c1f3
   > >
   > >
   ----------------------------------------------------------------------
   > > - This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > > [13]http://www.scottklement.com/mailman/listinfo/ftpapi
   > >
   ----------------------------------------------------------------------
   > > -
   > >
   > >
   >
   >
   >
   #######################################################################
   ##############
   >
   > The provisions of Sections 11,12, and 13 of the Electronic
   > Communications and Transactions Act, 25 of 2002, in so far as e-
   > contracting is concerned is expressly excluded and contracted out by
   > Barloworld South Africa (Pty) Ltd ("Barloworld") and no data message
   > or electronic communication will be recognised as having legal
   > contractual status as per the aforementioned provisions under any
   > circumstances. All contracts concluded by Barloworld, its Business
   > Units, Divisions and Subsidiaries will only be legally binding and
   > recognised once reduced to physical writing and physically signed by
   > a duly authorised representative of Barloworld.
   >
   > All other provisions of  the Electronic Communications and
   > Transactions Act, 25 of 2002 are accepted.
   >
   >
   #######################################################################
   ##############
   > Note:
   > This message is for the named person's use only.  It may contain
   confidential,
   > proprietary or legally privileged information.  No confidentiality
   > or privilege
   > is waived or lost by any mistransmission.  If you receive this
   > message in error,
   > please immediately delete it and all copies of it from your system,
   > destroy any
   > hard copies of it and notify the sender.  You must not, directly or
   > indirectly,
   > use, disclose, distribute, print, or copy any part of this message
   > if you are not
   > the intended recipient. Avis and any of its subsidiaries each reserve
   > the right to monitor all e-mail communications through its networks.
   >
   > Any views expressed in this message are those of the individual
   > sender, except where
   > the message states otherwise and the sender is authorized to state
   > them to be the
   > views of any such entity.
   >
   > Thank You.
   >
   #######################################################################
   ##############
   > [Bild entfernt]
   >
   -----------------------------------------------------------------------
   > This is the FTPAPI mailing list.  To unsubscribe, please go to:
   > [14]http://www.scottklement.com/mailman/listinfo/ftpapi
   >
   -----------------------------------------------------------------------

   --
   IMPORTANT NOTICE:
   This email is confidential, may be legally privileged, and is for the
   intended recipient only. Access, disclosure, copying, distribution, or
   reliance on any of it by anyone else is prohibited and may be a
   criminal
   offence. Please delete if obtained in error and email confirmation to
   the sender.

References

   1. mailto:ftpapi-
   2. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   3. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   4. file://localhost/tmp/www.avg.com
   5. http://www.scottklement.com/mailman/listinfo/ftpapi
   6. cid:112101005501801501@mail41.mimecast.co.za
   7. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   8. mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
   9. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
  10. http://www.avg.com/
  11. http://www.scottklement.com/mailman/listinfo/ftpapi
  12. https://mail41.mimecast.co.za/mimecast/click?account=CSA20A3&code=b58e
  13. http://www.scottklement.com/mailman/listinfo/ftpapi
  14. http://www.scottklement.com/mailman/listinfo/ftpapi

Attachment: Stored_Proc_Example.zip
Description: Zip archive

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------