× 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 think a slight misunderstanding. The number of occurrences is not number 
occurrences that you want. You always use the maximum number of occurrences 
which is 32767 for Multiple Occurrence Data Structures, 65537 for array and 
32766 for SQL Arrays (Multiple Occurrence Data Structures). 
 
Code is same for every program.
 
You might use 2 or you might use 50 but you always declare at max. Because it 
is based on pointer, never uses more than you request and User Spaces handles 
the extension automatically. All number means is that the run time will stop 
you if you exceed the max occurrences. 
 
One other suggestion. If you are going to use pointer math, you might want to 
write a procedure and put in a service program with other general purpose 
functions to do the work so you end up with:
 
Types are below are standard types Standard Pointer(StdPTR), Standard 
Integer(StdInt), Standard Integer Small(StdIntSml).
 
 * Calculate pointer on array up to 3 dimensions. 
d GENP_GetPointerToArrayOccurrence...
d                pr           Like(StdPtr)
d   PR_BasePointerToUserSpace...
d                             Like(StdPtr)
d   PR_RecordSize...
d                             Like(StdInt)
d   PR_Demension1...
d                             Like(StdIntSml)
d   PR_Demension2...
d                             Like(StdIntSml)
d                             Option(*NoPass)
d   PR_Dimension3...
d                             Like(StdIntSml)
d                             Option(*NoPass)
 /Free
 
  // Calculate pointer on single dimensioned array.
  ptrDataStructure = GENP_GetPointerToArrayOccurance(BasePointer         :
                                                     %Size(DataStructure):
                                                     1                   );
 
  // Calculate pointer on two dimension array. 
  ptrDataStructure = GENP_GetPointerToArrayOccurance(BasePointer         :
                                                     %Size(DataStructure):
5                                            :
2                   );
 
From that point on, you do not have to remember the math each time. 
 
You are probably better at the math than I am. Every time I write the math, I 
always make some mistake so write it once and use it over and over. 
 
Anyway, just a suggestion. 
 
 
thanx. allready tried that and it works really fine. but i like the idea of 
__not__ having to set the number of elements at the time writing the code. but 
thanx.
 
mk
 
-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im 
Auftrag von Alan G. Campin
Gesendet: Freitag, 23. Juni 2006 18:11
An: rpg400-l@xxxxxxxxxxxx
Betreff: RE: writing to userspace
 
A simpler way to do it is to let the compiler handle the pointer math for you. 
This works find as long as you will not have more than 65537 records for array 
of records or 32767 for multiple occurrence data structure. 
 
First way is to use a multiple occurrence data structure.  
 
d dsStructure...
d                           ds                      Qualified
d                                                   Occurs(32767)
d                                                   Based(ptrStructure)
d  YourField1...
d  Yourfield2...

 


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.