SEQUENCE CONTROL STATEMENTS
STOP Statement
This performs to stop or to halt the execution of the program.Format:
STOP RUN/Lit.
NOTE:
- RUN is the instruction for the computer to run or execute the next possible program. This hands over the control to the operating system (O.S.) after its execution.
- Literal is any Numeric or Non-numeric. This form temporarily halts the program execution, the literal is communicated to the operator and operator intervention is required to resume program execution.
- The programmer should try to use STOP RUN instead of STOP (Lit.).
Examples:
- STOP 5.
- STOP "hellow".
- STOP RUN.
GO TO Statement
It is used to branch, depart or transfer the sequence of the execution of statement unconditionaly.Format:
GO TO ( procedure name).
PROCEDURE DIVISION Page
![]()
GO TO ... DEPENDING ON Statement
Format:
GO TO (List of procedure names) DEPENDING ON (data item).Note:
- When the transfer of control is required to some procedure conditionally the data item that contains the whole number value.
- The control is transfered to the procedure (whose name is present in the format) at the position number by taking the value of data item.
- Data item must be defined unsign integer.
Examples:
GO TO islamabad karachi lahore quata peshawar DEPENDING ON CITY-CODE. GO TO AJK. islamabad. move 'capital' to city-type GO TO ajk. karachi. move 'sind' to city-type GO TO ajk. lahore. move 'punjab' to city-type GO TO ajk. quata. move 'baluchistan' to city-type GO TO ajk. peshawar. move 'nwfp' to city-type GO TO ajk.
PROCEDURE DIVISION Page
![]()
PERFORM Statement
- This verb is used to perform a specified procedure (contains one or more than one statements) and back to next instruction after it.
- The difference of GO TO statement and PERFORM statement is skipping but not back and skipping but back respectively.
Format:
PERFORM ( procedure name).Examples:
PERFORM calc-proc.TIMES option in PERFORM statement
This option of PERFORM verb means to execute the specified procedure or procedures a number of time.Format:
PERFORM (procedure name) Integer/data neme TIMES.Examples:
PERFORM add-rtn 50 TIMES.UNTIL option in PERFORM statement:
This option in PERFORM is valid if the execution of some routine/s is/are required conditionaly.Format:
PERFORM (procedure name) UNTIL (condition).Note:
* By use of UNTIL the condition is checked before the procedure/s is/are to be executed. * If the condition is true the procedure will not be executed.THROUGH/THRU option in PERFORM statement
Whenever a series of procedures are to be performed this option may be used. This gives the range of procedures and starts to perform from top to bottom.Format:
PERFORM (Procedure name S) THROUGH/THRU (Procedure name E).Note:
Procedure name S is the Starting procedure and Procedure name E is ending procedure.Example:
PERFORM abc THROUGH xyz. STOP RUN. abc. MOVE'abc' TO A-B-C. imn. MOVE 'imn' TO L-M-N. pqr. MOVE 'pqr' TO P-Q-R. xyz. MOVE 'xyz' TO X-Y-Z.
PROCEDURE DIVISION Page
![]()
Nested Perform Statement:
It is possible to have one or more PERFORM statements in the range of procedure S to procedure E with the use of THRU option.EXIT Statement:
- It happens when certain conditions exist and it is required to reach the end of the PERFORM usage or to bypass the statements in between.
- This verb does not mean to terminate the executation rather it has no-op (no Operation). It is also called as non executable statement.
- It is followed by a procedure name.
- It is better to use in last procedure defined in PERFORM....THRU option.
Reserved Words | Symbols |
IS LESS THAN | < |
IS GREATER THAN | > |
IS EQUAL TO | = |
IS GREATER THAN OR EQUAL TO | >= |
IS LESS THAN OR EQUAL TO | <= |
IS NOT EQUAL TO NOT | = |