Ü  CLEAR (Clear)

·         The CLEAR operation sets any element’s value to its default initialization value.

·         This op-code can be used to clear record format, data structure or its subfield, array or its element, any numeric, string, indicator etc.

·         In case we are using multiple occurrence data structure then to clear a particular occurrence of that data structure, we can set the occurrence of that to the occurrence which we want to clear.

·         In case we are using multiple occurrence data structure then to clear all occurrences of it, we need to put *ALL in factor-2.

·         In case we want to clear any array element we can set the index of the array to the element that we want to clear. E.g. CLEAR        ARR1(1)

·         In case we want to clear all elements of the array, just mention array name in factor-2 for clear op-code.

·         If *NOKEY is specified in factor-1 then key fields are not cleared in the file record format even if we are mentioning *ALL in factor-2.

·         If *ALL is not specified then only the fields in Output or Both mode is affected by the clear operation in a display file record format.

 

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

*NOKEY or Blank

CLEAR

*ALL or Blank

Element to be cleared

 

 

 

 


Example


Columns . . . :    1  80              Browse                               AMINEM/QRPGLESRC
SEU==>                                                                             OP_CLEAR
FMT D  .....DName+++++++++++ETDsFrom+++To/L+++IDc.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data *********************************************************
0001.00      DA                S              2  0 INZ(11)                                   
0002.00      DARR1             S             15    CTDATA  DIM(2) PERRCD(1)                 
0003.00      DDS1              DS                                                           
0004.00      DFLD1                     1      6A                                            
0005.00      DFLD2                     7     11A                                            
0006.00      C                   EVAL      FLD1='CLEAR'                                     
0007.00      C                   EVAL      FLD2='THIS'                                      
0008.00      C     A             DSPLY                                                      
0009.00      C     DS1           DSPLY                                                       
0010.00      C     ARR1(1)       DSPLY                                                      
0011.00      C     ARR1(2)       DSPLY                                                      
0012.00      C                   CLEAR                   A                                  
0013.00      C                   CLEAR                   DS1                                
0014.00      C                   CLEAR                   ARR1(1)                             
0015.00      C     A             DSPLY                                                      
0016.00      C     DS1           DSPLY                                                      
0017.00      C     ARR1(1)       DSPLY                                                      
0018.00      C     ARR1(2)       DSPLY                                                      
0019.00      C                   SETON                                        LR            
0020.00 **CTDATA ARR1                                                                       
0021.00 ELEMENT01                                                                           
0022.00 ELEMENT02                                                                            
****************** End of data ************************************************************



OUTPUT

 

DSPLY  11         

DSPLY  CLEAR THIS 

DSPLY  ELEMENT01  

DSPLY  ELEMENT02  

DSPLY   0         

DSPLY             

DSPLY             

DSPLY  ELEMENT02  

 











User Comments:



Subscribe

.  


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