Thursday, March 14, 2013

RPGLE AS/400 PROBLEM/SOLUTION FOR RNX0412 DATA AREA


Have you ever encountered an error while coding your program.  And the solution does not help you at all?  Well I have one experience. Here is the error and the corresponding "recovery".

----------------------------------------------------------------
RNX0412: 
Message . . . . :   Data area %1/%2 is not allocated for output.         
Cause . . . . . :   An RPG procedure tried to update data area %1/%2 but the data area was not allocated for update.                                  
Recovery  . . . :   Contact the person responsible for program maintenance to  determine the cause of the problem.          
-----------------------------------------------------------------

Uhh.. So that's how I will recover the error.  To contact myself. Hellooooooooo....... Thanks.. That's a big help for me.

Fortunately, I was able to do my research.  Thanks to the sample 
that I got.  I hope this will really "recover" your problem.

Happy coding! :)

-----------------------------------------------------------------
Here is a sample program to do this:
====================================================================
     C                   Z-ADD     0             #AREA             9 0 
     C     *DTAARA       DEFINE                  #DAREA            9 0 
     C     *LOCK         IN        #DAREA                               
     C                   ADD       1             #DAREA                 
     C                   Z-ADD     #DAREA        #AREA                 
     C                   OUT       #DAREA                               
     C                   MOVE      '1'           *INLR               
=====================================================================