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



Mike Silvers wrote:
I am trying to have a multiple occurrence data structure and manipulate it
using pointers.  I am having a problem.  I am always getting the last data I
have entered.  Here is the sample program:

D Structure       DS
D    Struct_F1                  20
 *
D StructurePoint...
D                 S               *
D SPH             S               *
 *
D TestData        S             20A
 *
 * Load the DS
 *
C                   Eval      SPH = %Addr(Structure)
C                   Eval      StructurePoint = %Addr(Structure)
C                   Eval      Struct_F1 = 'Position #1'
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      Struct_F1 = 'Position #2'
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      Struct_F1 = 'Position #3'
 *
 * Loop through the DS
 *
C                   Eval      StructurePoint = SPH
C                   Eval      TestData = Struct_F1
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      TestData = Struct_F1
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      TestData = Struct_F1
 *
C                   Return

any ideas in where I am going wrong?

what I am trying to accomplish is a have an unlimited number of data
structure's sent to the program and in the program I loop through the data
structures and process the information.  The parms passed will be the
pointer to the data structure and the number of occurrences.
Try coding something like:

----------------------------------------------------------------
D Structure       DS                 BASED(StructurePoint)
D    Struct_F1                  20
 *
D StructurePoint...
D                 S               *
D SPH             S               *
 *
D TestData        S             20A
 *
 * Load the DS
 *
C                   EVAL      StructurePoint = %ALLOC(SIZE)
C                   EVAL      SPH = Structure
C                   Eval      Struct_F1 = 'Position #1'
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      Struct_F1 = 'Position #2'
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      Struct_F1 = 'Position #3'
 *
 * Loop through the DS
 *
C                   Eval      StructurePoint = SPH
C                   Eval      TestData = Struct_F1
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      TestData = Struct_F1
C                   Eval      StructurePoint =
C                                StructurePoint + %Size(Structure)
C                   Eval      TestData = Struct_F1
 *
C                   Return
--------------------------------------------------------------------

That is, you need to define your DS as based, and you need to
allcoate storage for the DS somehow.

Cheers!  Hans





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.