View previous topic :: View next topic
|
Author |
Message |
Sumeendar
New User
Joined: 31 Jan 2006 Posts: 39
|
|
|
|
Hi,
How to display cobol table elements in vertical manner (without using file).
eg. array contains A10504 A10405 A10806......
Should display in sysout like
A10504
A10405
A10806
.
.
.
.
Thanks
SS |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Iterate across the array and DISPLAY each element. |
|
Back to top |
|
|
Sumeendar
New User
Joined: 31 Jan 2006 Posts: 39
|
|
|
|
I am not sure whether iterate across array will work.
The reason is...
background
My input file has following entries like below
E105
E107
E105
E107
and i am storing these in a 1 dimensional array (as below) having 2 fields, entry and its occurances
01 WS-TABLE.
05 WS-ARRAY OCCURS 10 TIMES INDEXED BY INDX1.
07 WS-ARR1.
10 ENTRY PIC X(04).
10 OCCUR PIC 9(2).
Now above entries will be stored in the array like this.
E10502E10702
Now, my requirement is to display the above like below
E10502
E10702
Is it possible? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
The term "iterate" in computer science means to repeat something (a statement or a group of statement) for each element of the array. To do anything with an array in COBOL or other procedural languages, you iterate across the elements of the array. APL, for one, allows you to treat the entire array as an entity but most commonly used languages require you to look at each element of the array.
As my earlier post stated, what you want to do is quite easily done in COBOL. This forum is for professionals; if you do not know how to do this in COBOL -- and worse, do not know if it is possible in COBOL, you need to go to IBM Mainframe Forum which is a forum for beginners and students instead. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Agree with Robert - you will be better served in our other forum.
Also, it makes no sense and wastes everyone's time to post one situation when this is not the real situation. . . .
d |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Ah - APL - now that's a fun language! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
For some value of "fun"? |
|
Back to top |
|
|
|