× 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: Convert an MI program to RPG
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Sun, 02 Jul 00 19:26:06 +1000


Hello Bill,

You wrote:
>Hi everyone.  Would it be possible to change the following MI program to use 
>RPG/ILE 
>instead?  

Yes

>It is a program that obtains a pointer to a supplied qualified object.

No it's not.  It is a program that returns a pointer to the associated space of 
a 
supplied qualified object.

>If this is more appropriate to the MI list, feel free to reply there as I am a 
subscriber there as well.

It's probably more appropriate for the C400 list which is how you should be 
doing MI 
if you don't want to rub the bare metal -- RPG is not really the ideal choice 
due to 
its limited pointer support).

Here is some RPG that appears to satisfy your requirements.  A very cursory 
check 
indicates it points to the right stuff.  There are other methods of 
implementing this 
but the following code is similar to the C implementation.

     H DFTACTGRP(*NO) ACTGRP('QILE') BNDDIR('QC2LE')
     D RSLVSP          PR              *   EXTPROC('rslvsp')
     D   intObjType                   4    VALUE
     D   intObjName                  31
     D   intLibName                  31
     D   reqAuth                      4
     D SETSPPFP        PR              *   EXTPROC('setsppfp')
     D   objPtr                        *
     D TESTMI          PR
     D   libName                     10
     D   objName                     10
     D   objType                     10
     D   spcPtr                        *
     D   rtnCode                      1
     D TESTMI          PI
     D   libName                     10
     D   objName                     10
     D   objType                     10
     D   spcPtr                        *
     D   rtnCode                      1

     D $ERROR          C                   CONST('1')
     D $OK             C                   CONST('0')
     D $AUTH_NONE      C                   CONST(X'00000000')
     D $NULL           C                   CONST(X'00')

     D @obj            S               *

     D rslvObj_T       DS
     D   intObjType                   4
     D   intObjName                  31
     D   intLibName                  31
     D   reqAuth                      4

     C                   EVAL      rtnCode = $ERROR

      * Resolve to object
     C                   EVAL      intObjType = objType
     C                   EVAL      intObjName = %TRIM(objName) + $NULL
     C                   EVAL      intLibName = %TRIM(libName) + $NULL
     C                   EVAL      reqAuth = $AUTH_NONE
     C                   EVAL      @obj = RSLVSP( intObjType :
     C                                            intObjName :
     C                                            intLibName :
     C                                            reqAuth )

      * Address the associated space
     C                   EVAL      spcPtr = SETSPPFP( @obj )


     C                   EVAL      rtnCode = $OK

     C                   SETON                                        LR
     C                   RETURN

This is a test program and I kept the interface the same as your MI example 
even 
though the object type should be a CHAR(2) rather than CHAR(10).  Note that in 
the RPG 
version both the object type and requested authority are 4-byte values even 
though the 
machine uses 2-byte values.  This is because the rslvsp C function being used 
expects 
an int.  I haven't investigated this state fully yet.  Suffice it to say the 
above 
appears to do what you want.  Caveat emptor.

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be
pen at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.