Free software training Videos

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

List Of Best WebSites

Saturday 17 November 2012

if statement in as400

The If (IF) command is used to state a condition that, if true, specifies a statement or group of statements in the procedure to be run.

if is used for checking the condition.

example


if the particular condition is true execute some statements

PGM                                                             
             DCL        VAR(&AGE) TYPE(*DEC) LEN(3) VALUE(10)   
             IF         COND(&AGE = 10) THEN(SNDPGMMSG MSG('HI'))
ENDPGM                      



USING DO AND ENDDO COMMANDS



0001.00 PGM                                                                 
0002.00             DCL        VAR(&AGE) TYPE(*DEC) LEN(3) VALUE(10)        
0003.00              IF         COND(&AGE = 10) THEN(DO)                    
0004.00              SNDPGMMSG  MSG('WELCOME TO AS 400')                    
0005.00              SNDMSG     MSG('HI RAMESH HOW ARE YOU') TOUSR(CHVRAMESH)
0006.00              ENDDO                                                  
0007.00                                                                     
0008.00 ENDPGM                                                               
                                

No comments:

Post a Comment