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

Reference modification for one dimentional table


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

New User


Joined: 06 May 2007
Posts: 16
Location: pune

PostPosted: Fri May 25, 2007 2:48 pm
Reply with quote

Hi,
i have one table defined as
WS-DEBITOR-TABLE PIC X(150) OCCURS 1000 TIMES INDEXED BY DEBITOR-IDX

In this case can I use a reference modification to select the perticular string like

WS-DEBITOR-TABLE(DEBITOR-IDX)(20:24)

Please tell me its very urgent

thanks
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri May 25, 2007 3:10 pm
Reply with quote

Quote:
Please tell me its very urgent

It is strange when people say it is urgent and WASTE a lot of their time by expecting answers from others.
Even I had not used such reference modification before but it took me just 2 minutes to test it with simple program.
Code:
 
  01 TEXT-VAR PIC X(10).
  01 TEMP1.                       
      05 V1 PIC X(10) OCCURS 10 TIMES.
 PROCEDURE DIVISION.               
      MOVE 'ABHIJIT' TO V1(1).     
      MOVE 'K' TO V1(2).           
      MOVE V1(1)(1:7) TO TEXT-VAR
      DISPLAY TEXT-VAR.           
      STOP RUN.   

I got it running so answer to your question should be YES.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri May 25, 2007 4:13 pm
Reply with quote

adarsh.bhalke wrote:
can I use a reference modification to select the perticular string
Why would you think you couldn't?
Personally, I keep forgetting what must come first, the RM or the subscript....when I get wrong, the compiler corrects me.... icon_redface.gif
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Fri May 25, 2007 5:28 pm
Reply with quote

Here's how to remember: the refmod acts on a character string. A table name sans subscript or index is not a character string, and by itself elicits a compiler error, hence the refmod follows the sub/idx.
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top