• Subject: Re: DS fields
  • From: "James W. Kilgore" <qappdsn@xxxxxxx>
  • Date: Tue, 13 Jul 1999 11:27:58 -0700
  • Organization: Progressive Data Systems, Inc.

David,

The explanation I received wasn't as detailed as Doug's ...

Now this may be way off, but it stopped me asking questions ;)

In order to use (at that time) very expensive memory efficiently, a 10k of
total variable space would be broken up into 512 byte (or whatever) pages.

These pages are dynamically assigned an offset from a base real address at
program load time, variables are addressed as an offset from this page address
space.  So the address for a variable may be something like: page offset  +
variable offset within page

I always had a sneaking hunch that when the compiler was trying to determine
which variables belonged in which page, it started with the data structure so
that the subfield address would still be: page offset + variable offset within
page.

This address resolution works for the data structure and it's subfields.

AFAIK, variables do -not- reference the I/O buffer.  The compiler translates
RPG I and O specs into buffer/variable/buffer moves.  The sweet part of some
languages (assembler comes to mind) is that you can do direct buffer
manipulation. It makes programs very fast if you can copy from the file buffer
directly to a print buffer and skip the variable step.

James W. Kilgore
qappdsn@ibm.net

David Prowak wrote:

> > Did any of this make sense?
> >
> > Doug
> Nice explanation.  I still have a question though.
>
> >  Subfields are not pointers per se, they just have addresses within the
> address >  space for the DS as a whole.
> If that is the case, then how do you account for a field from a file that
> is "sub divided" in a DS?
> Ex:
> File is MasterFile, opened for I/O
> Field is Acct#
>
>  D                 DS
>  D  Acct#                     1      8
>  D      Acct#Zone         1      2
>  D      Acct#Region      3      5
>  D      Acct#Territory   6      8
>
> Read  MasterFile
> Move '999'    Acct#Region
> Update MasterRecFormat
>
> In this case, a portion of the DS is altered, and the updated Acct# is
> written to MasterFile.  I thought that the Acct# DS had a pointer to
> the I/O buffer where MasterFile is read from & written from.
> If pointers aren't used, how does this the change in the DS show
> up in the change in the file?
>
> Thanks,
> Dave
>

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This thread ...

Replies:

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