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



<snip>
Sorry, Aaron.  I think we're talking at cross purposes here.  Do you
mean you want to do this?
     d a           s        type(whatever)
     d b           s        type(whatever)
     a.proc(parm);
     b.proc(parm);
</snip>

Yes that is what I mean.

>But you can already do a pretty good job of creating your own data types in
RPG.
I'll agree that it kinda works in RPG, but not necessarily a good job.  What
if I want to have multiple instantiations of the same object in my program?

D addr1        s       TYPE(ADDRESS)
D addr2        s       TYPE(ADDRESS)

addr1.setCity("Denver")
addr1.setState("CO")
...
addr2.setCity("Chicago")
addr2.setState("IL")

and then let's say I want to pass that address into my tax calculation
routine. . .

tax = calcTax(35.12:addr1)

Now calcTax will have my addr1 object and all of its functions (getCity,
getState, etc).  You can emulate this with data structures, sort of, except
you don't get the functions of the object.

The other cool thing about having a create-your-own-datatype approach is
that there most likely will be a base object much like java has -- Object.
Now if I want to have a vector full of different types of objects I can.
There are a lot of other bennies that could be listed also.

Yes this can be programmed into RPG to a certain extent, but it should be
seen as such a fundamental aspect of a language that it should be at the
compiler level vs. application, IMO.

Aaron Bartell



-----Original Message-----
From: Barbara Morris [mailto:bmorris@ca.ibm.com]
Sent: Monday, September 30, 2002 1:50 PM
To: rpg400-l@midrange.com
Subject: Re: Qualified sub-procedures


"Bartell, Aaron L. (TC)" wrote:
>
> I think my want for qualified procedure names comes more for a want to
> create my own data types within the language and the qualified procedure
> names are just a step in that direction.  If we were given the ability to
> create our own data types then I would have no need for the qualified
> procedure names, I would just have to be able to qualify the instantiation
> of an object so I could specify directly which procedure I was referring
to.
>
> I can see all these steps being taken to simulate our own data types (work
> with me here -- ILE sub procedures, QUALIFIED data structures, etc...) I
> guess what I am wondering is when RPG is going to make the leap to being
> able to create it's own data types?  I think that would be a revolutionary
> step in the life of RPG as a programming language and would greatly
benefit
> the language as far as new interest goes.
>

Sorry, Aaron.  I think we're talking at cross purposes here.  Do you
mean you want to do this?
     d a           s        type(whatever)
     d b           s        type(whatever)
     a.proc(parm);
     b.proc(parm);
If that's what you're asking for, then I have no idea if or when RPG
might go down that path.

I was talking about module MODA having procedure proc and module MODB
having procedure proc, and callers being able to say MODA.proc() or
MODB.proc().  If that's also what you were talking about, then I don't
see the connection to creating your own data types.

But you can already do a pretty good job of creating your own data types
in RPG.

 * copy file for module XYZ
D XYZ_Handle_t       s        10i 0

D XYZ_Create         pr               LIKE(XYZ_Handle_t)
D XYZ_Destroy        pr
D    handle                           LIKE(XYZ_Handle_t) const

D XYZ_DoSomething    pr
D    handle                           LIKE(XYZ_Handle_t) const
D    parm                             whatever

 * User for type XYZ
 /copy XYZ
D myXYZ              s                LIKE(XYZ_Handle_t)

c          eval     myXYZ = XYZ_Create()
c          callp    XYZ_DoSomething (myXYZ : someparm)
c          if       XYZ_getFld1 (myXYZ) = 0
c          callp    XYZ_setFld2 (myXYZ : 'abc')
...
c          callp    XYZ_Destroy (myXYZ)

or, if you want your users to access some of the data directly:

 * copy file for module XYZ
D XYZ_Handle_t       ds               qualified
D    private                    10i 0
D    fld1                       10i 0
D    fld2                       10a

D XYZ_Create         pr
D    handle                           LIKEDS(XYZ_Handle_t) const
D XYZ_Destroy        pr
D    handle                           LIKEDS(XYZ_Handle_t) const

D XYZ_DoSomething    pr
D    handle                           LIKEDS(XYZ_Handle_t) const
D    parm                             whatever

 * User for type XYZ
 /copy XYZ
D myXYZ              ds                LIKEDS(XYZ_Handle_t)

c          callp    XYZ_Create(myXYZ)
c          callp    XYZ_DoSomething (myXYZ : someparm)
C          if       myXYZ.fld1 = 0
c          eval     myXYZ.fld2 = 'abc'
...
c          callp    XYZ_Destroy (myXYZ)

Barbara
    ===


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


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.