MainframeMaster

COBOL Tutorial

COBOL REVERSED Phrase - Quick Reference

Progress0 of 0 lessons

Overview

The REVERSED phrase in COBOL is used in report writer to reverse the direction of line or column output. It is useful for specialized reporting requirements, such as printing from bottom to top or right to left.

Purpose and Usage

  • Report Writer - Control the direction of line or column output
  • Specialized Reports - Print data in non-standard directions
  • Language Support - Support right-to-left languages
  • Custom Formatting - Meet unique business requirements

Syntax

cobol
1
2
3
4
5
6
7
8
9
10
11
12
* Use LINE REVERSED in report writer 01 REPORT-GROUP TYPE DETAIL LINE REVERSED. * Use COLUMN REVERSED in report writer 01 REPORT-GROUP TYPE DETAIL COLUMN REVERSED. * Example report group 01 SALES-REPORT TYPE DETAIL LINE REVERSED. 03 SALES-AMOUNT PIC 9(7)V99. 03 SALES-REGION PIC X(10). * Note: REVERSED is not used for string manipulation; use FUNCTION REVERSE for that purpose.

Use REVERSED in report writer to control output direction. Not all compilers support this feature.

Test Your Knowledge

1. What is the primary use of the REVERSED phrase in COBOL?

  • To reverse the order of lines or columns in report output
  • To reverse the order of characters in a string
  • To reverse arithmetic operations
  • To reverse the program flow

2. Where is REVERSED most commonly used in COBOL?

  • INSPECT statement
  • Report writer LINE or COLUMN clauses
  • PERFORM statement
  • READ statement

3. Is REVERSED supported in all COBOL compilers?

  • Yes
  • No
  • Only in mainframe COBOL
  • Only in modern COBOL

4. Which of the following is a valid use of REVERSED?

  • LINE REVERSED
  • COLUMN REVERSED
  • BOTH
  • Neither

5. What is the effect of using LINE REVERSED in a report?

  • Lines are printed from bottom to top
  • Lines are printed from top to bottom
  • Columns are reversed
  • No effect

Frequently Asked Questions