COBOL DISPLAY with No Advancing Example
Scenario - DISPLAY with no advancing.
Code -
----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. DISPWNOA.
       AUTHOR. MTH.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-VAR.
          05 WS-VAR1      PIC X(05) VALUE 'HELLO'.
          05 WS-VAR2      PIC X(05) VALUE 'WORLD'.
       PROCEDURE DIVISION.
      * Display with no Advancing
           DISPLAY WS-VAR1 WITH NO ADVANCING.
           DISPLAY " " WS-VAR2.
           STOP RUN.Output -
HELLO WORLD
Explaining Example -
In the above example:
- It declares two variables, WS-VAR1 and WS-VAR2, each capable of holding 5 characters.
- WS-VAR1 is initialized with the value "HELLO" and WS-VAR2 is initialized with the value "WORLD".
- It displays the content of WS-VAR1 without advancing to the next line (using "WITH NO ADVANCING"), and then displays a space followed by the content of WS-VAR2. So, the output will be "HELLO WORLD" with no newline between them.
