Ü  DEFINE (Field Definition)

·         Factor-2 represents the name of referenced dataarea name referred by result field. It can be any external dataarea, *LDA, *PDA.

·         Result field represents any internal variable, a data structure, a data-area data structure, program status data structure, file information data structure or any program defined data area.

·         The result field is taken for operation IN and OUT in the program.

 

Ü  DEFINE INTERNAL FIELDS BASED ON DATAAREA

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

*DTAARA      

DEFINE

Referenced dataarea referred by result field

Internally defined field based on factor-2 field

 

 

 

 

 

Example


Columns . . . :    6  76            Edit                           AMINEM/PRJ1
 SEU==>                                                                  GENACC
 FMT C  CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq
        *************** Beginning of data *************************************
0004.00 C     *DTAARA       DEFINE                  DA               12        
0005.00 C     *ENTRY        PLIST                                               
0006.00 C                   PARM                    A1               12        
0007.00 C     *LOCK         IN        DA                                       
0008.00 C                   MOVEL     DA            C                12        
0009.00 C                   MOVEL     *ZEROS        I                12 0      
0010.00 C                   EVAL      I=%INT(C)                                
0011.00 C                   ADD       1             I                          
0012.00 C                   EVAL      C=%CHAR(I)                               
0013.00 C                   MOVEL     C             DA                         
0015.00 C                   MOVEL     C             A1                         
0016.00 C                   OUT       DA                                       
0017.00 C                   UNLOCK    DA                                       
0019.00 C                   SETON                                        LR    
0020.00 C                   return                                             
        ****************** End of data ****************************************

 

                               Display Data Area    
System:   USALID09
 Data area . . . . . . . :   DA
   Library . . . . . . . :     QGPL
 Type  . . . . . . . . . :   *CHAR              
 Length  . . . . . . . . :   30               
 Text  . . . . . . . . . :                
            Value
 Offset      *...+....1....+....2....+....3....+....4....+....5
     0      '100000000001'                   
 
 
                                      
 F3=Exit   F12=Cancel                         
 


On each call of this program auto-generation of number will happen.

The generated number will be updated to the dataarea.

 


Ü  DEFINE INTERNAL FIELDS BASED ON EXTERNAL FIELDS

Factor 1

OpCode

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

*DTAARA      

DEFINE

Referenced external field to be referred by result field

Internally defined field based on factor-2 field

 

 

 

 

 


Columns . . . :    6  80               Edit                                  AMINEM/QRPGLESRC
SEU==>                                                                              OP_DEFINE
FMT C  CL0N01Factor1+++++++Opcode&ExtFactor2+++++++Result++++++++Len++D+HiLoEq....
*************** Beginning of data ************************************************************
0001.00 C                   Z-ADD     12.3          FLD1              3 1               130128
0002.00  *                                                                              130128
0003.00 C     *LIKE         DEFINE    FLD1          FLD2                                130128
0004.00 C     *LIKE         DEFINE    FLD1          FLD3             -1                 130128
0005.00 C     *LIKE         DEFINE    FLD1          FLD4             +1                 130128
0006.00  *                                                                              130128
0007.00 C                   EVAL      FLD2=12.3                                         130128
0008.00 C                   EVAL      FLD3=1.2                                          130128
0009.00 C                   EVAL      FLD4=123.4                                        130128
0010.00 C                   SETON                                        LR             130128
0011.00                                                                                 130128
****************** End of data ***************************************************************



OUTPUT

FLD1 = 12.3  

FLD2 = 12.3       

FLD3 = 1.2          

FLD4 = 123.4

 











User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy