• Subject: RE: Externalize DB/IO (was What Counts as Technically Slick?)
  • From: bmorris@xxxxxxxxxx
  • Date: Thu, 12 Apr 2001 09:42:31 -0400
  • Importance: Normal

>Date: Wed, 11 Apr 2001 08:38:01 -0600
>From: "Nathan M. Andelin" <nathanma@haaga.com>
>Syntax # 1:
>D myStructure E DS ExtName(myFile) Import
>C Eval myReturn = myFunction()
>Syntax # 2:
>D myStructure E DS ExtName(myFile) Based(myBasePointer)
>C Eval myReturn = myFunction(myBasePointer)
>I'm trying to determine whether Syntax # 2 is better than Syntax # 1.
>are functionally equivalent.  Under Syntax # 2, myFunction must explicitly
>set myBasePointer to the address of it's version of myStructure.  Under
>Syntax # 1, the pointer mapping is implied.

Nathan, how about syntax #3:

D myStructure E DS ExtName(myFile)
C Eval myReturn = myFunction(%addr(myStructure))

Or better yet, syntax #4:

D myStructure E DS ExtName(myFile)
C Eval myReturn = myFunction(myStructure)

I think parameters are better than import/export.
a. There is no checking to make sure an import is the
   same type and length as an export.
b. Ideally, functions don't have side-effects affecting
   data visible to the caller. When reading the call, it
   is useful and sometimes necessary to know that
   myStructure is involved somehow, either used or

There is(*) a change coming in V5R1 that will make it
convenient to use syntax #4 within the procedure.  You
will(*) (finally) be able to receive a data structure
parameter directly as a data structure without pointer

(*) "probably", subject to change without notice before GA

D someStructure E DS          extname(myFile)
P myFunction      B
D myFunction      PI    10i 0
D   myParm                    likeds(someStructure)
C            eval    myParm.something = somethingelse
P                 E

You might define someStructure in the same file as
your prototype, and then use LIKEDS to define myStructure
in the caller, too.  You won't even need to use the
external file, if you don't want to.  (Probably (snicker).)

Barbara Morris

| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].