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



I'll jump in - *DEFINED lets you specify what you can call subfields for another variable - it's not a "formal" data structure definition but does give essentially the same effect, admittedly a lot like early DS definitions.

Here's an example -

  /* Request information with subfields - returned from CHKRQS */
  DCL        VAR(&REQUEST) +
               TYPE(*CHAR) +
               LEN(32)

  /* A/R account */
  DCL        VAR(&ACCOUNT) +
               TYPE(*CHAR) +
               STG(*DEFINED) +
               LEN(8) +
               DEFVAR(&REQUEST 1)
  /* Service location */
  DCL        VAR(&LOCATION) +
               TYPE(*CHAR) +
               STG(*DEFINED) +
               LEN(4) +
               DEFVAR(&REQUEST 9)
  /* Sender name */
  DCL        VAR(&SENDERNAME) +
               TYPE(*CHAR) +
               STG(*DEFINED) +
               LEN(20) +
               DEFVAR(&REQUEST 13)

The TYPE() can be anything, not only *CHAR.

There is no qualification of the variable names, though.

*BASED allows the use of pointers - this makes working with API results much nicer, instead of all those %SST things!

I pass the &REQUEST variable to, say, an RPGLE that has a DS defined - that fills the subfields. Then when this comes back, the 3 variables are readily available.

Maybe it's not the most elegant use, but it helps me.

HTH
Vern

On 7/9/2019 10:52 AM, David Gibbs via MIDRANGE-L wrote:
On Tue, Jul 9, 2019 at 10:48 AM DrFranken <midrange@xxxxxxxxxxxx> wrote:
Don't we get most of this with *DEFINED and *BASED variables and using
includes to pull the definitions in?
Not sure I follow you ... could you post an example?

david



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.