MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

need to refer an element within an array

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Aug 08, 2007 3:49 pm    Post subject: need to refer an element within an array Reply with quote

Hai all,

I have an internal table as below and i would like to access the field WS-EARN-NUM each item with index.How can i achive it?
If i want to achive WS-DESC 5 th element i can use WS-DESC(WS-IDX) but how to refer WS-NUM.Please help me out ?
Code:

          05 WS-ENTRY                 OCCURS 10 TIMES
                                      INDEXED BY WS-IDX.
             10 WS-KEY.
                15 WS-DATE       PIC X(10)            VALUE SPACES.
                15 WS-NUM        PIC X(03)            VALUE SPACES.
             10 WS-DESC          PIC X(10)            VALUE SPACES.
             10 WS-HRS           PIC S9(03)V99 COMP-3 VALUE 0.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Wed Aug 08, 2007 4:02 pm    Post subject: Reply with quote

since WS-EARN-NUM is not defined as part of the table, you can't.
Quote:

If i want to achive WS-DESC 5 th element i can use WS-DESC(WS-IDX)


you can access the 5th occurance of WS-DESC by SETting WS-IDX to 5.

If in your carelessness writing this post you meant WS-NUM and not WS-EARN-NUM, you can access any occurance with the syntax WS-NUM(WS-IDX) after SETting WS-IDX to the appropriate occurance.

To the left of the 'Submit' button on the bottom of the page is a 'Preview' button, which is like 'desk-checking'.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
yadav2005
Intermediate


Joined: 10 Jan 2005
Posts: 348
Topics: 144

PostPosted: Wed Aug 08, 2007 4:20 pm    Post subject: Reply with quote

Thanks dbzTHEdinosauer for the help and i am able to understand and i carelessly mentioned WS-EARN-NUM it should have been WS-NUM and from my next posts i will be careful before posting.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Aug 09, 2007 8:10 am    Post subject: Reply with quote

yadav2005,

There is nothing special about accessing WS-NUM. It is just the same as any other table element

Code:

SET WS-IDX TO 5       
DISPLAY WS-NUM(WS-IDX)


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group