Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ll-xn!mit-eddie!genrad!decvax!ucbvax!MITRE.ARPA!stansbury%mwvms From: stansbury%mwvms@MITRE.ARPA Newsgroups: comp.os.vms Subject: DCL scoping of labels in subroutines Message-ID: <8707011941.AA06570@mitre.arpa> Date: Wed, 1-Jul-87 15:41:42 EDT Article-I.D.: mitre.8707011941.AA06570 Posted: Wed Jul 1 15:41:42 1987 Date-Received: Sat, 4-Jul-87 04:59:21 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The MITRE Corp., Washington, D.C. Lines: 66 -------- The following command procedure shows what appears to be a bug in the DCL scoping of labels in command procedures. When this command procedure is invoked on a VMS V4.5 system and you answer 1 to the first prompt and 2 to the second, you get the following error message: %DCL-W-USGOTO, target of GOTO not found - check spelling and presence of label when DCL attempts to execute the $ if c .ne. 3 then goto a1_start ! a1 statement. Note that the label A1_START is indeed defined at that procedure level. If, however, you switch the order of the a2 and c2 subroutines, the command procedure works okay. Has anyone else seen this behavior, and if so, do you have any suggestions for ways around it (besides switching the order of a2 and c2)? Jack Stansbury jws@mitre.arpa $ on warning then stop $ write sys$output "Answer 1 to the first prompt and 2 to the second prompt" $start: $ write sys$output "This is start" ! start $ inquire a "Input a" ! start $ if a .eq. 1 then call a1 start ! start $ if a .eq. 2 then call a2 start ! start $ if a .eq. 3 then exit ! start $ goto start ! start $ $b1: subroutine ! b1 $ write sys$output "This is b1 called from ''p1'" ! b1 $ write sys$output "Exit back to ''p1'" ! b1 $ exit ! b1 $ endsubroutine ! b1 $ $a1: subroutine ! a1 $a1_start: ! a1 $ write sys$output "This is a1 called from ''p1'" ! a1 $ inquire c "Input c" ! a1 $ if c .eq. 2 then call c2 a1 ! a1 $ if c .ne. 3 then goto a1_start ! a1 $ write sys$output "Exit back to ''p1'" ! a1 $ exit ! a1 $ endsubroutine ! a1 $ $a2: subroutine ! a2 $a2_start: ! a2 $ write sys$output "This is a2 called from ''p1'" ! a2 $ inquire c "Input c" ! a2 $ if c .eq. 1 then call c1 a2 ! a2 $ if c .eq. 2 then call c2 a2 ! a2 $ if c .ne. 3 then goto a2_start ! a2 $ write sys$output "Exit back to ''p1'" ! a2 $ exit ! a2 $ endsubroutine ! a2 $ $c2: subroutine ! c2 $ write sys$output "This is c2 called from ''p1'" ! c2 $ call b1 c2 ! c2 $ write sys$output "Exit back to ''p1'" ! c2 $ exit ! c2 $ endsubroutine ! c2