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

Clarification on INDEX & SET statement


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
yugendran

New User


Joined: 14 Dec 2007
Posts: 51
Location: indore

PostPosted: Sat Feb 11, 2012 5:32 pm
Reply with quote

Hi,

In the below declaration,

SET LETTERPOS TO LETT. => Compilation error
SET LETTERPOS TO LETTERIDX. => This one compiled fine.

Only differnece, is LETTERIDX => used to index a table
LETT => decalred as a index variable.

So is it right to say that we can use set non-index variable to index variable only for index used with occurs clause.. I am not sure what i am missing here..

Declaration:

Code:
01  LETTERTABLE.                                 
    02 LETTERVALUES.                             
       03 FILLER PIC X(13)                       
          VALUE "ABCDEFGHIJKLM".                 
       03 FILLER PIC X(13)                       
          VALUE "NOPQRSTUVWXYZ".                 
    02 FILLER REDEFINES LETTERVALUES.             
       03 LETTER PIC X OCCURS 26 TIMES           
                       INDEXED BY LETTERIDX.     
    02 FILLER REDEFINES LETTERVALUES.             
       03 LETTE1 PIC X OCCURS 26 TIMES           
                       ASCENDING KEY IS LETTE1   
                       INDEXED BY LETTERID1.     
01 LETTERIN      PIC X.                           
01 LETT          USAGE IS INDEX.                 
01 LETTERPOS     PIC 99.                         
01 PRNPOS        PIC Z9.                         

Statements:

Code:
ACCEPT LETTERIN.             
SET LETTERIDX TO +1.         
SET LETTERPOS TO LETT.       
SET LETTERPOS TO LETTERIDX.   
MOVE 1 TO LETTERPOS.         


Thanks
Yuge
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Sat Feb 11, 2012 5:46 pm
Reply with quote

using the code tags to make your code more readable will make answering a pleasure rather than a pain in the a** icon_cool.gif
Your topic was edited ...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Feb 11, 2012 6:00 pm
Reply with quote

What you are missing is reading the manuals. Link at the top of the page.

If there is anything which is unclear after that, explain your problem and someone will clarify.

As well as looking at SET (you only need format 1 for your question, but may as well see the other marvels at the same time) you should check on USAGE INDEX.
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 -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Cobol file using index COBOL Programming 2
No new posts JOIN STATEMENT PERFORMANCE. DFSORT/ICETOOL 12
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts process statement for SUPREC, CMPCOLM... TSO/ISPF 4
Search our Forums:

Back to Top