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
 

 

Need description about array and index

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
HARIBHARAT

New User


Joined: 05 Jul 2006
Posts: 65
Location: pune

PostPosted: Wed Sep 06, 2006 8:35 pm    Post subject: Need description about array and index
Reply with quote

Give me brief description about array and index i need sample code with result, i face the problem this related.

Bye
suresh
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Sep 06, 2006 9:25 pm    Post subject:
Reply with quote

Hi Suresh,


05 ws-array occurs 10 times
ascending key is ws-empid
indexed by I.
10 ws-empid pic 9(12).
10 ws-empname pic x(15).

05 ws-array1 occurs 12 time.
10 ws-vara pic 9(2).
10 ws-varb pic x(2).


05 J pic S9(4) comp.


Procedure Division.
Init-para.
perform varying J from 1 by 1 until i>12
initialize ws-vara(J), ws-varb(J)
end-perform.

Search-para.
set I to 1.
SEARCH ws-array VARYING I
AT END DISPLAY 'Emp not found'
WHEN ws-empid(I) = 4211
DISPLAY "Emp Name ", ws-empname(I)
END-SEARCH.

Here I is indexed for this table its decvlaration is not require & J is a variable. which is used as subscript & weneed to declare this variable is working storage


An index is defined with it's associated table using the INDEXED BY phrase. It is a storage area generated by the compiler. It is 4 bytes in length. You can?t display an index. The SET statement sets up and down an index.
A subscript is a positive integer defined in working-storage. It's best to define it as S9(4) COMP. A subscript is changed using ADD, SUBTRACT, MOVE or PERFORM VARYING.
Back to top
View user's profile Send private message
krishna_sureka

New User


Joined: 05 Sep 2006
Posts: 7
Location: Pune

PostPosted: Wed Sep 06, 2006 11:40 pm    Post subject: Re: Iam doubt about array and index
Reply with quote

Any inputs on which one should be used in which case and what difference it makes.

Thanks
Krishna.
Back to top
View user's profile Send private message
HARIBHARAT

New User


Joined: 05 Jul 2006
Posts: 65
Location: pune

PostPosted: Thu Sep 07, 2006 11:41 am    Post subject: Re: Need description about array and index
Reply with quote

Thanks ektha.

iam very thankful ibmmainframes site, i learned lot here, i want to congratulate each and evryone, i did not have words describe.

Thanks

suresh
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Sep 07, 2006 2:39 pm    Post subject:
Reply with quote

Krishna,

If we want to search on the table & need to pass it to calling program then index is better option.

Suresh,

Its EKta not ektha icon_smile.gif
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts TWS EQQYCAIN - not sure how to get ap... mbenaud IBM Tools 0 Wed Dec 14, 2016 8:45 pm
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm


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