SKIP Statement Example


Scenario1 - Coding SKIP1 statement in COBOL program.

Code -

----+----1----+----2----+----3----+----4----+----5----
       01 EMP-REC.
          COPY EMPREC.
		  SKIP1.
		  
	   01 WS-VAR.
	      05 WS-INPUT1        PIC X(10).

Explaining Example -

  • SKIP1 statement won't display in the program listing.
  • SKIP1 inserts one blank line before WS-VAR declaration line in the program listing.

Scenario2 - Coding SKIP2 and SKIP3 statements in COBOL program.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       01 EMP-INPUT-REC.
          COPY EMPREC REPLACING 
		           "==:EMP:==" BY  "==EMP-INPUT==".
          SKIP2.		  
		  
       01 EMP-OUTPUT-REC.
          COPY EMPREC REPLACING 
		          "==:EMP:==" BY  "==EMP-OUTPUT==". 
		  SKIP3.
		  
	   01 WS-VAR.
	      05 WS-INPUT1        PIC X(10).

Explaining Example -

  • SKIP2 and SKIP3 statements won't display in the program listing.
  • SKIP2 inserts two blank lines before EMP-OUTPUT-REC declaration line and SKIP3 inserts three blank lines before WS-VAR declaration.