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

Moving INDEX Variable to working stotage variable.


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

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Jan 17, 2006 3:08 pm
Reply with quote

Hi,

Is there a way to MOVE the value of Index Variable (on used in index by clause) to a working storage variable having PIC S9(4) COMP?
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Jan 17, 2006 4:39 pm
Reply with quote

Hey guys.

One way is:

Code:
01 A OCCURS 10 TIMES INDEXED BY IDX-A
    05 AA PIC X(10).
01 WS-AREA.
    05 WS-IDX-GRP-1.
         10 WS-IDX-TEMP       PIC INDEX
    05 WS-IDX-GRP-2.
         10 WS-IDX                PIC S9(06) COMP.

----
PROCEDURE DIVISION.

SET WS-IDX-TEMP TO IDX-A.
MOVE WS-IDX-GRP-1 TO WS-IDX-GRP-2.
DISPLAY WS-IDX.


OR

Code:
01 A OCCURS 10 TIMES INDEXED BY IDX-A
    05 AA PIC X(10).
01 WS-AREA.
    05 WS-IDX-GRP-1.
         10 WS-IDX-TEMP       PIC INDEX
    05 WS-IDX-GRP-2 REDEFINES WS-IDX-GRP-1.
         10 WS-IDX                PIC S9(06) COMP.

----
PROCEDURE DIVISION.

SET WS-IDX-TEMP TO IDX-A.
DISPLAY WS-IDX.


OR

Code:
01 A OCCURS 10 TIMES INDEXED BY IDX-A
    05 AA PIC X(10).
01 WS-AREA.
    05 WS-IDX-GRP-2.
         10 WS-IDX                PIC S9(06) COMP.

----
PROCEDURE DIVISION.

SET WS-IDX TO IDX-A.
DISPLAY WS-IDX.


Corrections welcome.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Cobol file using index COBOL Programming 2
Search our Forums:

Back to Top