MordernRPGSoldier
MordernRPGSoldier

Reputation: 83

Pointer not set error and a session crash in RPG program

I have a pointer not found error followed by a session crash during a call to a procedure but its not clear to me why. The error occurs at a rather simple assignment operation between two DS fields,

specifically the below line:

 GetWorkData.CopyRightPubDte = IACWRKDATA.WRKPUBLDTE; 

in below proc:

 //-------------------------------------------------------------------           
 // GetWork                                                                      
 //-------------------------------------------------------------------           
PGetWork...                                                                      
p                 B                   EXPORT                                     
FIACWRK001 IF   E           K DISK    rename(IACWRK:IACWRK001R) usropn           
F                                     static                                     
DGetWork...                                                                      
d                 PI              N                                              
D GetWorkKey                          likeds(P_IACWRKKey)                        
D                                     CONST                                      
D GetWorkData...                                                                 
D                                     LIKEDS(P_IACWRKFetchData)                  
                                                                                 
D* Local fields                                                                  
D retField        S               N                                              
D IACWRKData      ds                  likerec(IACWRK001R)                        
                                                                                 
 /FREE                                                                           
   retField = cFalse;                                                            
   clear GetWorkData;                                                            
   if not %open(IACWRK001);                                                      
     open(e) IACWRK001;                                                          
     if %error;                                                                  
       AddMessage('ALL9007':'IACWRK001 ':*Omit:*Omit);                           
       RETURN retField;                                                          
     endif;                                                                      
   endif;                                                                        
   chain(e) (GetWorkKey.WorkKey) IACWRK001R IACWRKDATA;                          
   if %error;                                                                    
     if not SndFileError(%Status(IACWRK001));                                    
       AddMessage('ALL9007':'IACWRK001 ':*Omit:*Omit);                           
     endif;                                                                      
     RETURN retField;                                                            
   endif;                                                                        
   if %found;                                                                    
     GetWorkData.WorkKey = IACWRKDATA.WorkKey;                                   
     GetWorkData.OriginalVersionInd = IACWRKDATA.WRKORGIND;                      
     GetWorkData.GenreOfWork =                                                   
                                     IACWRKDATA.WRKGENRE;                        
     GetWorkData.WorkCategory =                                                  
                                     IACWRKDATA.WRKCAT;                          
     GetWorkData.Duration =                                                      
                                     IACWRKDATA.WRKDUR;                          
     GetWorkData.SourceOfDoc=                                                    
                                     IACWRKDATA.SRCDOCWRK;                       
     GetWorkData.StatusOfWork =                                                  
                                     IACWRKDATA.WRKSTS;                          
     GetWorkData.WorkIsReferenced =                                              
                                     IACWRKDATA.WRKISREF;                        
     GetWorkData.WorkIsProhibited =                                              
                                     IACWRKDATA.WRKPROHIB;                       
     GetWorkData.FirstLicenseReferral =                                          
                                     IACWRKDATA.WRK1STREF;                       
     //GetWorkData.GenWrkLvlDispute =                                            
     //                                IACWRKDATA.WRKDISPLVL;                    
     //GetWorkData.POCIndicator =                                                
     //                                IACWRKDATA.WRKPOCIND;                     
     GetWorkData.OwnerOfDoc =                                                    
                                     IACWRKDATA.WRKOWNDOC;                       
     GetWorkData.ShareDivRulesApply =                                            
                                     IACWRKDATA.WRKSHRDIV;                       
     GetWorkData.LanguageOfLyrics =                                              
                                     IACWRKDATA.WRKLYRLNG;                       
     GetWorkData.IntendedPurposeOfWork =                                         
                                     IACWRKDATA.WRKPURPOSE;                      
     GetWorkData.CopyRightPubDte =                                               
                                     IACWRKDATA.WRKPUBLDTE;                      
     GetWorkData.InsertNumber = IACWRKDATA.InsNumber;                            
     GetWorkData.InsertUser   = IACWRKDATA.InsUser;                              
     GetWorkData.InsertDate   = IACWRKDATA.InsDate;                              
     GetWorkData.UpdateNumber = IACWRKDATA.UpdNumber;                            
     GetWorkData.UpdateUser   = IACWRKDATA.UpdUser;                              
     GetWorkData.UpdateDate   = IACWRKDATA.UpdDate;                              
     retField = cTrue;                                                           
   else;                                                                         
     AddMessage('WR00013':*omit:'IacWrk':'GetWork');                             
     return cFalse;                                                              
   endif;                                                                        
   RETURN retField;                                                              
                                                                                 
 /END-FREE                                                                       
PGetWork...                                                                      
p                 e      

Ive checked the values in debug and all seems okay.. any ideas ?

enter image description here

Job log:

                                     Statement . . . . . . . . . :   4                                                             
                                     Message . . . . :   Pointer not set for location referenced.                                  
                                     Cause . . . . . :   A pointer was used, either directly or as a basing                        
                                       pointer, that has not been set to an address.                                               
CEE3201    Diagnostic              10   25-01-26  21:18:23,952722  QLEAWI       QSYS        *STMT    QRNXUTIL    QSYS        *STMT 
                                     From module . . . . . . . . :   QLEDEH                                                        
                                     From procedure  . . . . . . :   Q LE leDefaultEh2                                             
                                     Statement . . . . . . . . . :   72                                                            
                                     To module . . . . . . . . . :   QRNXDATE                                                      
 5770SS1 V7R4M0 190621                           Job Log                            SEICEM04  25-01-26  21:18:24 CET     Page  249 
  Job name . . . . . . . . . . :   QPADEV0005      User  . . . . . . :   THEPAV       Number . . . . . . . . . . . :   976211      
  Job description  . . . . . . :   ICEDEVJOBD      Library . . . . . :   QGPL                                                      
MSGID      TYPE                    SEV  DATE      TIME             FROM PGM     LIBRARY     INST     TO PGM      LIBRARY     INST  
                                     To procedure  . . . . . . . :   _QRNI_DT_G_EH                                                 
                                     Statement . . . . . . . . . :   26                                                            
                                     Message . . . . :   Exception recursion detected.                                             
                                     Cause . . . . . :   An unhandled exception occurred in an exception handler.                  
                                       Recovery  . . . :   Do not let an exception that occurs in your exception                   
                                   handler go unhandled.                                                                       

*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3 5770SS1 V7R4M0 062119 DUMP 976211/THEPAV/QPADEV0005 SEICEM04 25-01-26 21:18:23 PAGE 1

QPSRVDMP

DUMP TAKEN FOR UNMONITORED ESCAPE MESSAGE                                                                                         
 .MESSAGE ID-                   MCH4401                                                                                            
 .MESSAGE FILE-                 QCPFMSG                LIBRARY-          *LIBL                                                     
 .SEVERITY-                     40                                                                                                 
 .MSGTYPE-                      0F                                                                                                 
 .SENDING-                                                                                                                         
 ..PROGRAM-                     Ex2C01InvalidReturnExt                                                                             
 LIBRARY-                                                                                                                          
 ..INSTRUCTION-                 0000A4                                                                                             
 .RECEIVING-                                                                                                                       
 ..PROGRAM-                     QUICMD                 LIBRARY-          QSYS                                                      
 ..INSTRUCTION-                 0404                                                                                               
 .MESSAGE-                                                                                                                         
   Return instruction not valid.                                                                                                   
 .MESSAGE DATA-                                                                                                                    
 END OF DUMP                                                                                                                       
                                           * * * * *  E N D  O F  L I S T I N G  * * * * *                                         
                                                                                                                                   
                                                                                                                             Bottom

Upvotes: 0

Views: 56

Answers (1)

MordernRPGSoldier
MordernRPGSoldier

Reputation: 83

So, the problem was that the procedure that was calling the GetWork proc did not have parms passed to it in the right order. The call to getwork is the third level of nested call (if I can call it so). The fact that the error was happening at this unsuspicious line made things confusing.

Upvotes: 0

Related Questions