×
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.
 
Alan Shore
Sent: Thursday, June 25, 2009 4:18 PM
To: RPG programming on the IBM i / System i
Subject: Reading a file into a data set
I have an externally defined file with the record consisting
of the following fields
Numbers01A  5  0
Numbers02A  5  0
Numbers03A  5  0
...
Numbers22C  5  0
Numbers23C  5  0
Numbers24C  5  0
Which in essence is 3 arrays of a 24 array
There is a way of reading this file into a 2 dimensional data set
(or am I getting COBOL flashbacks?)
Assuming the fields are defined in that exact order and that they're
contiguous, you should be able to do something like:
     D Set_T           DS                  Qualified                  
     D  Number                        5  0 Dim(24)                    
                                                                      
     D pFirstNum       S               *   Inz(%Addr(NUMBERS01A))     
     D BigArray        DS                  Qualified Based(pFirstNum) 
     D  Set                                Dim(3) LikeDS(Set_T)       
                                                                      
     D myRec         E DS                  ExtName(myFile) Qualified  
     **- or                                                           
     D myRec           DS                  LikeRec(myRecord)          
                                                                      
                                                                      
      /Free                                                           
                                                                      
       If BigArray.Set(2).Number(20) <> Numbers20B ;                  
          // I'll eat my hat                                          
       EndIF ;                                                        
                                                                      
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.