Page 1 of 1

CONTINUE in IF statement.

Posted: Wed Apr 18, 2018 8:37 pm
by Rima Bali
Hi -

Please see the following code:

Code: Select all

IF TB-ABCDE-NORESP AND WS-LTYPE-PART  
   AND TB-ABCDE-ACTIVE                   
   IF (WS-IMSSEG-NORESP                
	  AND OR-CA-CODE    = 'BO')    
	   OR (OEMJCARRI    = 'BO'     
	   OR  OEMCARRI     = 'BO')    
  	      IF TB-FLG AND 
        	 (WS-NO-H-SW = 'Y')         
          	CONTINUE

..
                    
In that below code is new code:

Code: Select all

IF TB-FLG AND 
        	 (WS-NO-H-SW = 'Y')         
          	CONTINUE
rest is existing code. My question is if I don't write CONTINUE, the control will still go to next executable statement. Is that correct? I have tested it but want to confirm if I got it correct.

One more thing I want to ask and that is in the existing code there are nested IF statements, why they have not used CONTINUE? Deos not that make a difference?

Re: CONTINUE in IF statement.

Posted: Wed Apr 18, 2018 9:55 pm
by Robert Sample
CONTINUE is a no-operation statement. There are a few places where you need it (such as in a paragraph with no other statements), but for the most part it is optional.

Re: CONTINUE in IF statement.

Posted: Fri Apr 20, 2018 10:42 am
by Rima Bali
Thanks for the insight. That means both the below codes will behave same?

Code: Select all

IF TB-ABCDE-NORESP AND WS-LTYPE-PART  
   AND TB-ABCDE-ACTIVE                   
   IF (WS-IMSSEG-NORESP                
	  AND OR-CA-CODE    = 'BO')    
	   OR (OEMJCARRI    = 'BO'     
	   OR  OEMCARRI     = 'BO')    
  	      IF TB-FLG AND 
        	 (WS-NO-H-SW = 'Y')         
          	CONTINUE

..

                    
and

Code: Select all

IF TB-ABCDE-NORESP AND WS-LTYPE-PART  
   AND TB-ABCDE-ACTIVE                   
   IF (WS-IMSSEG-NORESP                
	  AND OR-CA-CODE    = 'BO')    
	   OR (OEMJCARRI    = 'BO'     
	   OR  OEMCARRI     = 'BO')    
  	      IF TB-FLG AND 
        	 (WS-NO-H-SW = 'Y')         
          	
..
                    

Re: CONTINUE in IF statement.

Posted: Fri Apr 20, 2018 5:10 pm
by Robert Sample
What part of my first answer was unclear?

Re: CONTINUE in IF statement.

Posted: Tue Apr 24, 2018 10:50 am
by Rima Bali
Robert Sample wrote: Fri Apr 20, 2018 5:10 pmWhat part of my first answer was unclear?
Sorry if it offended you. Just wanted to confirm!

Re: CONTINUE in IF statement.

Posted: Tue Apr 24, 2018 10:58 am
by Keval Mehta
Rima Bali wrote: Wed Apr 18, 2018 8:37 pmOne more thing I want to ask and that is in the existing code there are nested IF statements, why they have not used CONTINUE? Deos not that make a difference?
Both the IFs will work same.

Re: CONTINUE in IF statement.

Posted: Tue Apr 24, 2018 5:08 pm
by Robert Sample
If you want to confirm your answer, why not search the Language Reference manual for what you want? Asking repeatedly the same question is asinine -- the first answer will not change if you ask seven times. And asking multiple times is implying that you don't trust the person's answer; unless you have some reason for that lack of trust, you should believe the answers you are given.

Re: CONTINUE in IF statement.

Posted: Thu Apr 26, 2018 7:55 pm
by Rima Bali
Thanks Robert. Your answer helped.