Free software training Videos

Free software training Videos
https://www.youtube.com/user/VLRTraining

List Of Best WebSites

Monday 19 November 2012

chgvar as400

 chgvar command in clp
Change Variable (CHGVAR)


       the dec variable not send directly to output in clp. so we can change it into char        
      it converts dec variable to char variable.
              

  
The Change Variable (CHGVAR) command changes the value of a Control
Language (CL) variable or part of a character variable.  The value
can be changed to the value of a constant, to the value of another
variable, or to the value gotten from the evaluation of an        
expression or a built-in function.  Expressions and built-in      
functions are described in "Expressions in CL Commands" in the CL 
concepts and reference topic in the iSeries Information Center at 
http://www.ibm.com/eserver/iseries/infocenter.  Also, implicit    
conversion between decimal and character values is performed by the
rules given in the VALUE parameter description.                   





*************** Beginning of data *************************************
0001.00 PGM                                                                   
0002.00              DCL        VAR(&AGE) TYPE(*DEC) LEN(3) VALUE(200)        
0003.00              DCL        VAR(&AGE1) TYPE(*CHAR) LEN(5)                 
0004.00              CHGVAR     VAR(&AGE1) VALUE(&AGE)                        
0005.00              SNDPGMMSG  MSG(&AGE1)                                    
0006.00 ENDPGM                                                                
        ****************** End of data ****************************************

output

 ===>                                                                         
 F3=Exit          F4=Prompt             F5=Refresh            F6=Create       
 F9=Retrieve      F10=Command entry     F23=More options      F24=More keys   
 00200                                                                        



example 2

        *************** Beginning of data *************************************
0001.00 PGM                                                                   
0002.00              DCL        VAR(&AGE) TYPE(*DEC) LEN(3) VALUE(200)        
0003.00              DCL        VAR(&AGE1) TYPE(*CHAR) LEN(5)                 
0004.00              CHGVAR     VAR(&AGE) VALUE(&AGE+1)                       
0005.00              CHGVAR     VAR(&AGE1) VALUE(&AGE)                        
0006.00              SNDPGMMSG  MSG(&AGE1)                                    
0007.00 ENDPGM                                                                
        ****************** End of data ****************************************

what is output?
write in comment
 

1 comment: