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
 
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 Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts LIBDEF not working in called proc packerm CLIST & REXX 0 Fri Sep 15, 2017 7:22 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am

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