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
 

 

Moving INDEX Variable to working stotage variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Moving INDEX Variable to working stotage variable.
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    Post subject:
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    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 Restart=Step not working ALAK SAHA JCL & VSAM 6 Fri Jun 30, 2017 6:28 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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