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 Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm
No new posts Order BY AND Index Nileshkul DB2 2 Sat Dec 31, 2016 6:33 pm


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