hi,
can any body say the answer fot this question?
how to display the value of the index variable?
how to display the value of the index variable in cobol
Re: how to display the value of the index variable in cobol
Have you tried to just display it? My manual doesn't forbid it.....dhiviya wrote:how to display the value of the index variable?
You could always set a numeric integer to the index and display that.....
Re: how to display the value of the index variable in cobol
ok i guess, u ve to define the index variable in the ws-section using INDEXED BY clause, now u can display it.. i ve not trird
u plz tr this and tell me.
u plz tr this and tell me.
-
- Posts: 5
- Joined: Sun Dec 09, 2007 3:27 pm
- Skillset: cobol,jcl,vsam,cics,db2
- Referer: google search
Re: how to display the value of the index variable in cobol
WE CAN'T DISLAY INDEX VARIABLE VALUE
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: how to display the value of the index variable in cobol
Hello,
Turn off your CAPS. . .
Yes, we can. Simply set some ws variable to the index and display that.
Turn off your CAPS. . .
Yes, we can. Simply set some ws variable to the index and display that.
Hope this helps,
d.sch.
d.sch.
-
- Posts: 7
- Joined: Tue Dec 18, 2007 12:39 pm
- Skillset: cobol
jcl
db2
cics - Referer: from friend
Re: how to display the value of the index variable in cobol
index variable can be displayed by using
set clsause
try this
set clsause
try this
-
- Posts: 10
- Joined: Thu Mar 19, 2009 11:28 am
- Skillset: jcl,cobol,cics.
- Referer: it is very famous
- Location: Shanghai.
Re: how to display the value of the index variable in cobol
I think you can't dipaly index variable. Index variable is S9(8) comp, takes up one word, it means the physical address in the main storage.Use set index-variable to integer, set index-variable up (down) by integer to assign value to index-variable.
I think what you can display is script, script is an integer, can be displayed.
I think what you can display is script, script is an integer, can be displayed.
--------------------------------------------------------------------------------------------------------------
Thanks ^_^
Hubery.
Thanks ^_^
Hubery.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: how to display the value of the index variable in cobol
Hello,

Why do you believe this? To repeat:I think you can't dipaly index variable.
Yes, we can. Simply set some ws variable to the index and display that.
How does this relate to the question?Index variable is S9(8) comp, takes up one word, it means the physical address in the main storage.
This surely needs clarification. . .I think what you can display is script, script is an integer, can be displayed.

Hope this helps,
d.sch.
d.sch.
-
- Posts: 10
- Joined: Thu Mar 19, 2009 11:28 am
- Skillset: jcl,cobol,cics.
- Referer: it is very famous
- Location: Shanghai.
Re: how to display the value of the index variable in cobol
Simply set some ws variable to the index and display that.
I follow the scentence and code such program.
05-ws-num1 pic s9(4) comp-3.
05 ws-num2 pic s9(4) comp.
05 ws-num3 pic s9(4).
05 ws-num4 pic 9(4).
SET index to 1.
SET index up by 2.
MOVE index TO WS-NUM1 WS-NUM2 WS-NUM3 WS-NUM4.
DISPLAY' INDEX-VARIABLE' WS-NUM1 WS-NUM2 WS-NUM3 WS-NUM4.
The SYSOUT is 'INDEX-VARIABLE 00030003000B0003'
But still i believe this is not the internal value of the INDEX-VARIABLE, this value is just like subscript.
Index variable is S9(8) comp, takes up one word, it means the physical address in the main storage.
How does this relate to the question?
I think the internal value of INDEX variable is physical address, so how can we display the physical address

though, to a COBOL PROGRAMMER, the knowledge of internal representation of of an index is of no importance.
--------------------------------------------------------------------------------------------------------------
Thanks ^_^
Hubery.
Thanks ^_^
Hubery.
- dick scherrer
- Global moderator
- Posts: 6268
- Joined: Sat Jun 09, 2007 8:58 am
Re: how to display the value of the index variable in cobol
Hello,
gives:
This
generates this errorso i don't know how your posted example successfully compiled. . .
Code: Select all
01 ZZ-STUFF.
05 ZZ PIC XXX OCCURS 100 TIMES INDEXED BY ZZ-INX.
01 ZZ-N PIC 9(8) COMP VALUE ZEROS.
SET ZZ-INX TO 1.
MOVE '111' TO ZZ(ZZ-INX).
DISPLAY ZZ(ZZ-INX).
SET ZZ-N TO ZZ-INX.
DISPLAY ZZ-N.
SET ZZ-INX UP BY 50.
MOVE 'U51' TO ZZ(ZZ-INX).
DISPLAY ZZ(ZZ-INX).
SET ZZ-N TO ZZ-INX.
DISPLAY ZZ-N.
gives:
Code: Select all
111
00000001
U51
00000051
This
Code: Select all
MOVE ZZ-INX TO ZZ-N.
generates this error
Code: Select all
IGYPS2074-S "ZZ-INX" WAS DEFINED AS A TYPE THAT WAS INVALID IN THIS CONTEXT.
Hope this helps,
d.sch.
d.sch.