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
 

 

Clarification on INDEX & SET statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Clarification on INDEX & SET statement
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Sat Feb 11, 2012 5:46 pm    Post subject: Reply to: Clarification on INDEX & SET statement
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Sat Feb 11, 2012 6:00 pm    Post subject: Reply to: Clarification on INDEX & SET statement
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    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 ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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