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

Can we display the INDEX? If yes, then how?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sunaina Javali

New User


Joined: 22 Apr 2009
Posts: 16
Location: Bangalore

PostPosted: Mon Jun 01, 2009 1:02 pm
Reply with quote

Hi,


please anybody helps me to know;
Can we display the INDEX? If yes, then how?


Thanks,
Nisha
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jun 01, 2009 1:19 pm
Reply with quote

The easiest way, which would work in all versions of COBOL is
SET W-S-VAR-PICS9(9)-USAGE-DISPLAY TO THE-INDEX-U-WANT-TO-DISPLAY
DISPLAY W-S-VAR-PICS9(9)-USAGE-DISPLAY
Back to top
View user's profile Send private message
Sunaina Javali

New User


Joined: 22 Apr 2009
Posts: 16
Location: Bangalore

PostPosted: Mon Jun 01, 2009 2:30 pm
Reply with quote

Thanks Dick

it's working icon_biggrin.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jun 01, 2009 3:09 pm
Reply with quote

thx for the feedback
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Tue Jun 02, 2009 1:46 am
Reply with quote

I thought it could be displayed directly. Even though it's stored as an offset, I think it's displayed as an occurrence number. Can't test since no mainframe access currently.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Jun 02, 2009 1:55 am
Reply with quote

If (as Terry has asked) you're looking for the actual displacement and you want to display this displacement, try the following -

Code:

03  WS-PACKED PIC  9(04)V9 COMP-3.
03  FILLER REDEFINES WS-PACKED.
     05  WS-FWORD PIC  9(08) COMP.
     05  FILLER PIC  X(01).
03  WS-DISPLAY PIC 9(08)V9.
03  WS-DISPLAY-X REDEFINES WS-DISPLAY PIC X(09).

MOVE ZERO TO WS-PACKED.
SET  WS-FWORD TO INDEX-NAME.
MOVE WS-PACKED TO WS-DISPLAY.

INSPECT WS-DISPLAY-X CONVERTING X'FAFBFCFDFEFF' TO 'ABCDEF'.

At this point, the actual index-displacement value can be found in displayable format in WS-DISPLAY-X (1:8).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jun 02, 2009 3:09 am
Reply with quote

Terry Heinze wrote:
I thought it could be displayed directly. Even though it's stored as an offset, I think it's displayed as an occurrence number. Can't test since no mainframe access currently.



some of the later versions of COBOL, yes.

Terry,

I just wanted to give him a solution that would work, regardless the VSN of COBOL or OPS-SYS.
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 How to display the leading zeros of a... DB2 7
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts SDSF display Max-RC in different colors TSO/ISPF 4
No new posts Add column to existing records using ... JCL & VSAM 2
Search our Forums:

Back to Top