CONTINUE

CONTINUE is used within a PROCESS or FOR loop to terminate processing of the current record, and continue with the next.  It has been provided to deal with some Easytrieve Conversion situations. 

SYNTAX

CONTINUE PROCESS; or CONTINUE FOR;

The CONTINUE statement must be written within a PROCESS or FOR loop.  A CONTINUE statement elsewhere, including in performed routines invoked from within the loop, is invalid.

If there are nested PROCESS statements, then the CONTINUE PROCESS statement is intended to cycle the innermost PROCESS loop. 

You are expected to write the CONTINUE statement within IF logic, as shown in Example.   CONTINUE should be followed by ELSEIF, ELSE, or END IF.  There will be error messages if it is not within the correct kind of loop, or if it is not followed by ELSE, but MANASYS does not check to see if there are any statements written after the relevant END IF.

FOR statements, unlike PROCESS statements, can be nested.  A CONTINUE FOR within an inner loop will skip a cycle of the inner loop.

CONTINUE PROCESS is only valid in batch programs, and may not be used in CICS programs.

Example

PROGRAM CopyIN1 BATCH;

COPY IN1;

COPY out1;

PROCESS in1;

                Some logic ….

                IF condition

                     [more logic]

                    CONTINUE PROCESS;

                ELSE;

        Out1.* = In1.*;

        WRITE out1;

     END IF;

     Logic here will not be executed if CONTINUE PROCESS was executed

END PROCESS in1; 

If there is no preceding logic then it is recommended that instead of IF and CONTINUE you write the equivalent WHERE condition as an option of the PROCESS or FOR statement.

There is no point in writing a CONTINUE statement as the last statement of the loop: its action is exactly if you’d reached the END statement anyway.

 

For example, when converting Easytrieve program: -

JOB INPUT FILE1    

IF COL3 = '  '     

   GO TO JOB       

END-IF             

PUT FILE2 FROM FILE1

   GO TO JOB

this program structure is established, and then the logic above is converted and copied at *#Copy Process logic here ==>.    

PROCESS File1;

*#Copy Process logic here ==>

END PROCESS File1; 

*#Copy Routines here ==>

In the conversion the GO TO JOB statements become CONTINUE PROCESS; and there will be messages because neither statement is followed by ELSE.  But actually,

IF COL3 = '  '     

   GO TO JOB       

END-IF             

is better as a WHERE option of PROCESS, and the final GO TO JOB is unnecessary because the logic is already at the END PROCESS.  The best Jazz program equivalent to the Easytrieve is simply

PROCESS File1 WHERE File1.Col3 <> '  ';

    WRITE FILE2 FROM(FILE1);

END PROCESS File1;