Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
6 Views

Q about variables in Contained routines

Suppose I have:

----------------------------------------------------------------------------

SUBROUTINE SUB1

integer ix,iy,iz

contains

subroutine sub1a

integer iz

print *,ix,iy,iz

end subroutine

end

-------------------------------------------------------------------------

Now notice I have iz declared twice. Would that be local to the contained routine?

I assume that the contained routine can reference ix, and iy.

Incidentally, one debugging headache is that if I am within

the contained routine, at a breakpoint, I cannot reference

any variables that are not declared INSIDE that routine.

So even though the routine can reference those variables, the DEBUGGER can NOT get their values.

Is there a way around that?

so far I have to insert P

0 Kudos
2 Replies
Highlighted
Beginner
6 Views

To reference those variables with the debugger, I have to insert

print statements, which defeats the purpose of having it there.

Variables in the calling sequence CAN be referenced, though

as well as local variables.

0 Kudos
Highlighted
6 Views

The iz you declare inside sub1a is local to the routine - ix and iy are "host associated". To see the variables in the host, use the "Stack Frame" pulldown to change the current frame to that of the outer routine.

Capture_8.PNG

Retired 12/31/2016
0 Kudos