IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Display cobol table elements in vertical manner


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Sat Sep 18, 2010 12:50 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Sat Sep 18, 2010 5:49 pm
Reply with quote

Iterate across the array and DISPLAY each element.
Back to top
View user's profile Send private message
Sumeendar

New User


Joined: 31 Jan 2006
Posts: 39

PostPosted: Mon Sep 20, 2010 5:00 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 20, 2010 5:14 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Sep 20, 2010 7:56 pm
Reply with quote

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. . . . icon_sad.gif

d
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Sep 20, 2010 8:06 pm
Reply with quote

Ah - APL - now that's a fun language!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 20, 2010 8:21 pm
Reply with quote

For some value of "fun"?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Load new table with Old unload - DB2 DB2 6
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Pulling a fixed number of records fro... DB2 2
Search our Forums:

Back to Top