You are here: Home > Knowledge Refreshers

KR edition 191 - 192


KR-191* (NEXT SENTENCE and CONTINUE)

Hi everyone,
Ever wondered the difference between ‘NEXT SENTENCE’ and ‘CONTINUE’ (or is there any difference at all?).

Idea for this KR triggered by Mansoor

NEXT SENTENCE and CONTINUE

NEXT SENTENCE:

  • NEXT SENTENCE causes the transfer of control (i.e. a GO TO) to the statement following the period (full stop) that terminates the sentence containing the ‘NEXT SENTENCE’.

  • It means the flow of logic just skips to the next sentence in the code; and we know Sentences in COBOL are separated by periods (full stop). So saying ‘NEXT SENTENCE’ is like saying ‘GOTO whatever follows the next period’.

CONTINUE:

  • The CONTINUE statement allows you to specify a no operation statement. CONTINUE indicates that no executable instruction is present. It transfers control to the next verb.

  • CONTINUE is most useful within a conditional phrase of another statement when no action is desired when the condition occurs (that is, correct COBOL syntax requires a statement even though the programmer wants nothing done).

  • Thus CONTINUE gives control to the next verb, while NEXT SENTENCE gives control to the verb following the next period.

CODE SNIPPET 1: NEXT SENTENCE

MOVE ZERO TO WS-COUNT
IF WS-COUNT = 0
NEXT SENTENCE
END-IF
ADD +1 TO WS-COUNT.
DISPLAY 'VALUE OF WS-COUNT: ' WS-COUNT

RESULT:
VALUE OF WS-COUNT: 00

(When NEXT SENTENCE phrase is encountered, control will not pass to the next statement following the END-IF but instead will pass to the statement after the closest following period.)

CODE SNIPPET 2: CONTINUE

MOVE ZERO TO WS-COUNT
IF WS-COUNT = 0
CONTINUE
END-IF
ADD +1 TO WS-COUNT.
DISPLAY 'VALUE OF WS-COUNT: ' WS-COUNT

RESULT:
VALUE OF WS-COUNT: 01


KR-192* (Preventing Mainframe session from getting logged off automatically)

The Mainframe session gets logged off automatically when you leave it unattended for some time. Due to this, many times we lose unsaved information. Ever wondered if there is a way to prevent this from happening?

KR Contributed by Yamini Vijendran.

OMVS Utility

  • Give option ‘=6’ in the command line to reach the ISPF Command Shell

  • Give the command ‘omvs’

  • Your login session goes to a ‘stand-by’ mode

  • When you want to activate your session again, type ‘exit’ (all small letters) in the command line and press Enter.

  • Press Enter again to go back to the Command shell

  • You can resume your work right from where you left it, without losing any valuable effort, or having to re-do anything!

  • OMVS command invokes the OMVS shell, and allows you to switch among the shell, a TSO/E session, and subcommand mode. You can find out more about this by pressing the HELP (F1) key.


Go back to the main contents page