MainframeMaster

COBOL Tutorial

SKIP2 - Insert Two Blank Lines

Progress0 of 0 lessons

What is SKIP2? When to use it?

SKIP2 creates a stronger visual break—two blank lines—between major sections such as report chapters, company divisions, or monthly subtotals.

COBOL Implementation

cobol
1
WRITE PRINT-REC AFTER ADVANCING 2 LINES

Equivalent to adding two blank lines before the next record is printed.

Guard near page end

cobol
1
2
3
4
IF LINE-COUNTER > PAGE-LIMIT - 2 WRITE PRINT-REC AFTER ADVANCING PAGE END-IF WRITE PRINT-REC AFTER ADVANCING 2 LINES

Report Writer alternative

cobol
1
2
3
4
5
01 BLANK-LINE TYPE DETAIL. 05 FILLER PIC X. ... GENERATE BLANK-LINE GENERATE BLANK-LINE *> SKIP2 via two blank details

Non-Code Scenarios

  • Separate one customer’s block from the next with two blank lines
  • Before a grand total at the end of a page

Best Practices and Mistakes

Best Practices

  • Use SKIP2 sparingly for major breaks
  • Coordinate with page limits to avoid widows/orphans

Common Mistakes

MistakeProblemFix
Overuse of SKIP2Wasted spaceAdopt spacing guidelines
No page-guardBreaks sections across pagesCheck LINE-COUNTER

Quick Reference

ActionSyntaxExample
Two blank linesWRITE ... AFTER ADVANCING 2 LINESWRITE PRINT-REC AFTER ADVANCING 2 LINES
GuardIF LINE-COUNTER > PAGE-LIMIT - 2Advance PAGE first

Test Your Knowledge

1. COBOL equivalent of SKIP2?

  • WRITE AFTER ADVANCING 2 LINES
  • DISPLAY AT 2,1
  • ACCEPT WITH UPDATE
  • EVALUATE

2. What should you check before SKIP2?

  • Compiler version
  • Available lines remaining on page
  • Dataset label
  • Timezone

Frequently Asked Questions

Related Pages