display vertically using cobol.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Leena
Registered Member
Posts: 30
Joined: Fri Aug 09, 2013 10:17 pm

display vertically using cobol.

Post by Leena »

Hi guys.

Can any one plz explain .
how to display "Indian army" vertically using cobol. if Indian army declared as a variable in pgm.
User avatar
zum13
Registered Member
Posts: 85
Joined: Thu May 04, 2023 12:58 am

Re: display vertically using cobol.

Post by zum13 »

Hello.

There's not a simple one-statement solution for this that I'm aware of, so it would have to be something along these lines:

Code: Select all

       01  WA-MESSAGE                  PIC X(11)  VALUE 'Indian Army'.
       01  WA-SUB                      PIC S9(4)  COMP.
.
.
           PERFORM VARYING WA-SUB FROM 1 BY 1 
                   UNTIL WA-SUB > 11
              DISPLAY WA-MESSAGE (WA-SUB:1) 
           END-PERFORM 
The "(WA-SUB:1)" bit is a substring that goes to the character indicated by WA-SUB and returns the characters for length of 1.

If you are doing this on a report, you reserve a space in the output line for a single character, then use the substring to move in the next character before you print the next line.
Leena
Registered Member
Posts: 30
Joined: Fri Aug 09, 2013 10:17 pm

Re: display vertically using cobol.

Post by Leena »

Thanks for the guidance. This is helpful.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”