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 

indexing

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


Joined: 18 Nov 2007
Posts: 9
Topics: 3

PostPosted: Thu Nov 22, 2007 11:43 pm    Post subject: indexing Reply with quote

can we comapre an index to a numeric value
eg:
a is a index
can i compare
if (a=1)

is it right?
Back to top
View user's profile Send private message Send e-mail
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Fri Nov 23, 2007 12:47 am    Post subject: Reply with quote

moulisea,

Are u referring to internal table index?

If yes, then yes... you can compare the index with numeric field.
Find below an example:

Code:


   
05  WS-TBL-ENTRIES      OCCURS 08 TIMES             
                                INDEXED BY INDEX-TAB.   
    10  WS-TBL-FLD-1         PIC X(10) VALUE SPACES. 
    10  WS-TBL-FLD-2         PIC S9(6) PACKED-DECIMAL.
    10  WS-TBL-FLD-3         PIC S9(6) PACKED-DECIMAL.

IF INDEX-TAB = 2
  ----
  ---
END-IF.


_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
moulisea
Beginner


Joined: 18 Nov 2007
Posts: 9
Topics: 3

PostPosted: Fri Nov 23, 2007 1:33 am    Post subject: INDEX Reply with quote

CAN WE define a index like below:

05 ws-sub usage is index
Back to top
View user's profile Send private message Send e-mail
warp5
Intermediate


Joined: 02 Dec 2002
Posts: 429
Topics: 18
Location: Germany

PostPosted: Fri Nov 23, 2007 1:57 am    Post subject: Reply with quote

Yes, the compiler will take care of your compare. Why don't you try it out?
Back to top
View user's profile Send private message Visit poster's website
moulisea
Beginner


Joined: 18 Nov 2007
Posts: 9
Topics: 3

PostPosted: Fri Nov 23, 2007 7:32 am    Post subject: Reply with quote

how do we initialize an index.
i used

initialize ws-var-a

where ws-var-a is an index.

it didnt work.
Back to top
View user's profile Send private message Send e-mail
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Fri Nov 23, 2007 9:35 am    Post subject: Reply with quote

SET ws-var-a to 1

Or If you want to set it to zero

SET ws-var-a to WS-ZERO where WS-ZERO is defined as PIC 9 VALUE ZERO
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Fri Nov 23, 2007 3:17 pm    Post subject: Reply with quote

moulisea,
You are asking very basic questions that are easily looked up in the COBOL Language Reference Manual.
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
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