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

To display USAGE IS INDEX item


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sudhakar.harish
Warnings : 1

New User


Joined: 06 Dec 2006
Posts: 3
Location: ERNAKULAM

PostPosted: Mon Dec 11, 2006 2:37 pm
Reply with quote

Is it possible to display index if so what will be displayed and how?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Mon Dec 11, 2006 3:22 pm
Reply with quote

Index of what?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Dec 11, 2006 4:09 pm
Reply with quote

Hi

You cant use the DISPLAY statement to see the contents of a table index.

Thanks
Arun
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 11, 2006 4:37 pm
Reply with quote

hi,

Because an index has a special internal representation it cannot be displayed and can only be assigned a value, or have its value assigned, by the SET verb. The MOVE cannot be used with a table index.
Back to top
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Mon Dec 11, 2006 4:44 pm
Reply with quote

if u want to print the value of the index then u have to define the INDEX DATA ITEM using USAGE IS INDEX in wrking strg section.....then move that index in tht index data item and then print that index data item....it will show u the value of ur index....
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 11, 2006 5:18 pm
Reply with quote

hey try this, sudhakar.harish....
using the SET verb u can assign the value of index to a data-name.and then display that data-name content... as shown below
Code:

WORKING-STORAGE SECTION.                   
01 A PIC 9.                               
01 FAC1.                                   
    02 FAC OCCURS 3 TIMES INDEXED BY F1.   
        04 SUBI PIC XX.                   
PROCEDURE DIVISION.                       
    SET F1 TO 3.                           
    SET A TO F1.                           
    DISPLAY A.                             
    STOP RUN.                             
 
Back to top
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Mon Dec 11, 2006 5:40 pm
Reply with quote

krisprems wrote:
hey try this, sudhakar.harish....
using the SET verb u can assign the value of index to a data-name.and then display that data-name content... as shown below
Code:

WORKING-STORAGE SECTION.                   
01 A PIC 9.                               
01 FAC1.                                   
    02 FAC OCCURS 3 TIMES INDEXED BY F1.   
        04 SUBI PIC XX.                   
PROCEDURE DIVISION.                       
    SET F1 TO 3.                           
    SET A TO F1.                           
    DISPLAY A.                             
    STOP RUN.                             
 



ya it will also wrk but wht i write previously will also wrk.....
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Dec 11, 2006 6:00 pm
Reply with quote

Hi yaju4ever

You cant use MOVE / DISPLAY statements with a USAGE IS INDEX data-item.Any item declared with USAGE IS INDEX can only appear in:


- A SEARCH or SET statement
- A relation condition
- The USING phrase of the PROCEDURE DIVISION
- The USING phrase of the CALL statement


Thanks
Arun
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Mon Dec 11, 2006 6:02 pm
Reply with quote

If I recall correctly, you can redefine it to a full word binary and display its value.
Back to top
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Mon Dec 11, 2006 6:47 pm
Reply with quote

arcvns wrote:
Hi yaju4ever

You cant use MOVE / DISPLAY statements with a USAGE IS INDEX data-item.Any item declared with USAGE IS INDEX can only appear in:


- A SEARCH or SET statement
- A relation condition
- The USING phrase of the PROCEDURE DIVISION
- The USING phrase of the CALL statement


Thanks
Arun




let me coorect my written explanation,,,,but my meant by wrting move was abt SET.....i am correctng it....
if u want to print the value of the index then u have to define the INDEX DATA ITEM using USAGE IS INDEX in wrking strg section.....then move that index in tht index data item using SET and then print that index data item....it will show u the displacement of a data item refered by tht indexs....but above code give krisperms will give u the value of index only.....
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Dec 11, 2006 6:54 pm
Reply with quote

Hi William

You are right.It s giving the desired result

Thanks
Arun
Back to top
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Mon Dec 11, 2006 7:07 pm
Reply with quote

hi wiliam ....thnx for cheking it and making me more confident abt my concept....
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 Cobol file using index COBOL Programming 2
No new posts STEM usage in REXX CLIST & REXX 14
No new posts z/OS Modules Usage report using SMF 42 DFSORT/ICETOOL 2
No new posts How to display the leading zeros of a... DB2 7
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
Search our Forums:

Back to Top