View previous topic :: View next topic
|
Author |
Message |
sudhakar.harish Warnings : 1 New User
Joined: 06 Dec 2006 Posts: 3 Location: ERNAKULAM
|
|
|
|
Is it possible to display index if so what will be displayed and how? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Index of what? |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi
You cant use the DISPLAY statement to see the contents of a table index.
Thanks
Arun |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
yaju4ever Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 19 Location: mumbai
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
yaju4ever Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 19 Location: mumbai
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If I recall correctly, you can redefine it to a full word binary and display its value. |
|
Back to top |
|
|
yaju4ever Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 19 Location: mumbai
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hi William
You are right.It s giving the desired result
Thanks
Arun |
|
Back to top |
|
|
yaju4ever Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 19 Location: mumbai
|
|
|
|
hi wiliam ....thnx for cheking it and making me more confident abt my concept.... |
|
Back to top |
|
|
|