Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10326
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: 7315

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 Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us