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



Tony, 

You need to define the files also as external datastructures. When you don't 
the program loads the fields from the file in a alphabetical sequence (check 
your compilation listing!) and not in the sequence you want them, that is the 
sequence in the record datatructure. So you need to add something like:
D #FAMLY       E DS                  EXTNAME(FAMLY)

Succes, Wilbert
  ----- Original Message ----- 
  From: Tony Carolla 
  To: RPG programming on the AS400 / iSeries 
  Sent: Thursday, December 02, 2004 2:08 AM
  Subject: BASED data structure anomaly(?)



                    I have two files, one of which contains the current aging 
bucket
                    values (FAMLY), and the other which needs it's aging 
buckets updated
                    (DFAMLY) from the other file.  In an attempt to speed this 
guy up, I
                    thought of using data structs for reading and comparing the 
two
                    recordsets, and updating as necessary, using a third file 
entry in
                    UPDATE mode.  I create two data structs for the aging 
fields within
                    the record formats, compare after a read from each file, 
and deal with
                    the differences.  The problem is that the packed numbers 
look funny in
                    my data structures, and they don't match what's in the 
LIKEREC data
                    structures.

                    I have the two files:

                         FDFamly    IF   E           K Disk    
ExtFile('DMART/DFAMLY')
                         F                                     InfSR(*PSSR)
                         F                                     Block(*Yes)
                         F                                     UsrOpn

                         FFamly     IF   E           K DISK    
ExtFile(FileFAMLY)
                         F                                     InfSR(*PSSR)
                         F                                     Block(*Yes)
                         F                                     UsrOpn

                    The two data structs:
                         D D               DS                  
LikeRec(RFamly:*Input)  //
                    DFAMLY file
                         D F               DS                  
LikeRec(FamRec:*Input) // FAMLY file

                    Within the two record formats, there are two 'chunks' of 
fields that
                    need to be compared:

                        D AgingChk1       DS                  Qualified
                         D                                     Based(pTemp)
                         D  Fmcrch                       11P 2
                         D  Fmcraj                       11P 2
                         D  Fmcrpm                       11P 2
                         D  Fmbdue                       11P 2
                         D  Fma000                       11P 2
                         D  Fma030                       11P 2
                         D  Fma060                       11P 2
                         D  Fma090                       11P 2
                         D  Fma120                       11P 2
                         D  Fma150                       11P 2

                         D AgingChk2       DS                  Qualified
                         D                                     Based(pTemp)
                         D  Fmzbal                        2P 0
                         D  Fmzyrm                        4P 0

                    I create two sets of these data structs, and their BASED 
pointers:
                        D DA1             DS                  Based(pDA1)
                         D                                     LikeDS(AgingChk1)
                         D FA1             DS                  Based(pFA1)
                         D                                     LikeDS(AgingChk1)
                         D DA2             DS                  Based(pDA2)
                         D                                     LikeDS(AgingChk2)
                         D FA2             DS                  Based(pFA2)

                         D pDA1            S               *   Inz
                         D pDA2            S               *   Inz
                         D pFA1            S               *   Inz
                         D pFA2            S               *   Inz

                    And I know, from using DSPFFD, and my own FI tool, that 
these are the
                    correct offsets for the aging data structs:

                           pDA1=%Addr(D)+186;
                           pDA2=%Addr(D)+268;
                           pFA1=%Addr(F)+163;
                           pFA2=%Addr(F)+245;

                    When I debug, and perform a set of reads:
                                  Read Famly F;
                                  Read DFamly D;

                    The F and D data structures contain the correct data from 
the record. 
                    But when I EVAL the DA1 and FA1 structures, the decimals 
look funny:

                    DA1.FMCRCH = 000000000.0
                    DA1.FMCRAJ = 000000000.0
                    DA1.FMCRPM = 000000000.0
                    DA1.FMBDUE = 000000000.0
                    DA1.FMA000 = 000000000.0
                    DA1.FMA030 = 000000000.0
                    DA1.FMA060 = 000000000.0
                    DA1.FMA090 = 000000000.0
                    DA1.FMA120 = 000000000.0
                    DA1.FMA150 = 000000000.0

                    And the DA2 and FA2 structs are just wacky:
                    DA2.FMZBAL = 0.  
                    DA2.FMZYRM = 11Ù.

                    Any ideas?  


                    -- 
                    "Enter any 11-digit prime number to continue..."

                    --
                    This is the RPG programming on the AS400 / iSeries 
(RPG400-L) mailing list
                    To post a message email: RPG400-L@xxxxxxxxxxxx
                    To subscribe, unsubscribe, or change list options,
                    visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
                    or email: RPG400-L-request@xxxxxxxxxxxx
                    Before posting, please take a moment to review the archives
                    at http://archive.midrange.com/rpg400-l.



                   
             
       

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.