Page 2 of 3

Re: Cobol code for displaying the output in the following format

PostPosted: Sun Jan 31, 2010 10:56 pm
by kranthi.kumarmca22
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 I PIC 9.
PROCEDURE DIVISION.
          PERFORM VARYING I FROM 1 BY 1 UNTIL I > 5
                   DISPLAY I WITH NO ADVANCING
          END-PERFORM.
          STOP RUN.


Will this give the output in the following format

1 2 3 4 5

One more doubt

How can i work with cobol programs at home.
I am having window 7 os in my pc.
which cobol compiler should i use.
Where can i download it for free.
Please suggest me a solution for this.

Re: Cobol code for displaying the output in the following format

PostPosted: Sun Jan 31, 2010 11:15 pm
by Robert Sample
How can i work with cobol programs at home.
I am having window 7 os in my pc.
which cobol compiler should i use.
Where can i download it for free.
Please suggest me a solution for this.
Google is your friend.

Re: Cobol code for displaying the output in the following format

PostPosted: Mon Feb 01, 2010 5:16 am
by dick scherrer
Hello,

Will this give the output in the following format
No. . . And obviously you did not read the informaton about DISPLAY in the COBOL manual. Why would you continue to flail away rather than simply reading the documentation?

If you install Hercules, you can have a "mainframe" on your pc. . .
http://www.hercules-390.org/

I don't know if this will run on Windows 7. Also, before downloading/buying a compiler, make sure this will also run on Windows 7. Lots of things do not. . .

Re: Cobol code for displaying the output in the following format

PostPosted: Mon Feb 01, 2010 7:12 am
by kranthi.kumarmca22
Thanks and sorry
I will go through it once again in detail
Thank you very much for your valuable suggestions.

Re: Cobol code for displaying the output in the following format

PostPosted: Mon Feb 01, 2010 8:00 am
by dick scherrer
You're welcome - good luck :)

d

Re: Cobol code for displaying the output in the following format

PostPosted: Tue Feb 02, 2010 9:20 pm
by kranthi.kumarmca22
Hello,

there are two variables--------var1 and var2
i am taking string in var1-------------var1="hello everybody"
var2 is empty
Now my question is what should be done to get

var1="hello"
var2="everybody"

Re: Cobol code for displaying the output in the following format

PostPosted: Tue Feb 02, 2010 9:38 pm
by Robert Sample
Look at UNSTRING in the COBOL Language Reference manual.

Re: Cobol code for displaying the output in the following format

PostPosted: Wed Feb 03, 2010 12:47 am
by dick scherrer
Hello,

Just a hint - if you want part of the result back in var1, move the entire input "string" to a work area before the UNSTRING.

Re: Cobol code for displaying the output in the following format

PostPosted: Wed Feb 03, 2010 11:20 pm
by kranthi.kumarmca22
Hello ,
Can you explain the hint a little more.
How to move the string to a work area.
what is work area and its importance.

Re: Cobol code for displaying the output in the following format

PostPosted: Wed Feb 03, 2010 11:31 pm
by Robert Sample
A work area is another variable of equal size that is used to hold a copy of the variable. The importance is that UNSTRING destroys the current contents of the receiving variables. Moving variables around is done by ... the MOVE statement.

Terminology note: COBOL does not have strings, which is a concept from C or similar languages. COBOL has variables. Variables can be numeric, numeric edited, alphabetic, alphanumeric, group, national, or DBCS (double-byte character set) -- but not string.