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



Anything BASED() takes 16 bytes of storage for the pointer. That is all. I am 
not sure why your program size is not changing size. It may be due to minimum 
requirements for a program. If a BASED() variable is declared in a 
subprocedure, the 16 bytes of storage exists for the life of the procedure. If 
declared in the main procedure, it exists for the life of the program or from 
the time that a module is loaded. If you look for Julian Moneypenny's Standard 
Definitions on IseriesNetwork, you will see that he use the same trick. All the 
standard definitions are based on a pointer so they do not take up storage for 
standard definitions. 

-----Original Message-----
From: Tyler, Matt [mailto:mattt@xxxxxxxxxxxxxx]
Sent: Monday, April 04, 2005 8:10 AM
To: 'RPG programming on the AS400 / iSeries'
Subject: Based data structure template


I need some clarification, please.
I have followed some threads that discuss using a data structure for as a
template and using the BASED() keyword.  According to what I understand I
read, the data structure is supposed to occupy no storage.  

I have done something I believe is similar to examples I have seen.
However, I do not see any difference in the program object size (verses not
using the BASED() keyword).  In the examples I have seen I see no reference
to using the BASED() data structure at the global definition level (which is
what I am doing).  

Example Line:
     D TYPES_DS      E DS                  EXTNAME(POSREFPF) BASED(TYPE_DEF)

I am using this to define other program work fields and prototype parameter
definitions using my common base definitions from my reference file.  This
way I do not have to rely on a file being defined just to base a work field
like a database field. 

Example Lines:
     D                 DS                  INZ
     D BOTID                               LIKE(@POSID)
     D BOTVER                              LIKE(@POSVER)
     D TOPID                               LIKE(@POSID)
     D TOPVER                              LIKE(@POSVER)


Now, I followed the same example Barbara Morris gave in post
"http://archive.midrange.com/rpg400-l/200311/msg00435.html";.  What she said
was what I saw (the object description size did remain the same, however).
However, the example was only in a sub-procedure.  If I modify the example
to be a main procedure the size does not change between using BASED() and
non-BASED() data structure (as per described in above post).  

So, my question is how do I tell that the BASED() data structure is not
actually using any storage when defined at the main procedure level?  I need
to prove to others that adding the BASED() keyword will not add overhead and
code complexity.  


Thank you,
Matt Tyler
WinCo Foods, Inc
mattt@xxxxxxxxxxxxxx


References:
http://archive.midrange.com/rpg400-l/200502/msg00208.html
http://archive.midrange.com/rpg400-l/200311/msg00435.html






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.