× 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 would check to make sure File2 isn't defined somewhere else and that is the 
one it is pulling into your program...

HTH
Kim

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of MD, Sadique
Sent: Thursday, August 25, 2005 5:22 AM
To: RPG programming on the AS400 / iSeries
Subject: Data structure gets populated for a junk value 


Hi all,

I have File1 defined as below

A          R REC1                        
A             FLD1          11P 2         


File2 defined as below 


A          R REC1                 
A            PACKED        11P 2  
A            NUM            4S 0  


I have a RPG program as below 

The value in File1/Fld1 = 131313123.12


FFILE1   IF  E                    DISK                               
IDS        EIDSFILE2                                                 

C                     READ FILE1                    80               
C           *IN80     DOWEQ*OFF                                      
C                     Z-ADDFLD1      PACKED
C           DS        DSPLY                                          
C                     READ FILE1                    80               
C                     ENDDO                                          
 *                                                                   
C                     SETON                     LR                   


1) The problem is the data structure "DS" is populated with Junk value 

2) When I debug I could see the data structure "DS" has only length of six 
   For Packed and length of four for Num , while the length provided for 
   PACKED in data structure should have been eleven
   when I execute Eval PACKED (Or F11 key) on debug command line I 
   have the correct value of File1/Fld1 = 131313123.12 in PACKED field too
   
3) If I look  at the spool file the data structure has the below structure  

      P   1   62PACKED
          7  100NUM   
      
    For "Num" the starting position should have been 12 15(0) Num
    The total length of the data structure "DS" is DS(10) 
    The length should have been = 15   
   
4) This problem exists in RPT, RPG, RPGLE , how ever I could over come the 
   problem if I define exclusively in the data structure for positions 
   1 to 11(2) Zoned for "PACKED" field   
   
I am currently working on V5R3, could some one please help me on this


Thanks
Sadiq 
 


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.