Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Display cobol table elements in vertical manner

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: Display cobol table elements in vertical manner
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Sat Sep 18, 2010 5:49 pm    Post subject:
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    Post subject: Reply to: Display cobol table elements in vertical manner
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Mon Sep 20, 2010 5:14 pm    Post subject:
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

Site Director


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

PostPosted: Mon Sep 20, 2010 7:56 pm    Post subject: Reply to: Display cobol table elements in vertical manner
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

Active Member


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

PostPosted: Mon Sep 20, 2010 8:06 pm    Post subject:
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: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Mon Sep 20, 2010 8:21 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us