Article 159364 of comp.os.vms: Dave Cannell wrote: > > I think that I've noticed a similair problem if the distance to the > GOTO'd label is quite far away... > > Dave > > Hans-Peter Harpoeth (hph@bang-olufsen.dk) wrote: : Hello > > : Some time ago I ran into the following (strange?) problem in a DCL progra= > : m. > : %DCL-W-USGOTO, target of GOTO not found - check spelling and presence of = > : label > > : I reduced the code to the following: > > : $ set verify > : $ ! > : $ if "TRUE" > : $ then > : $ gosub A > : $ endif > : $ exit > : $ ! > : $ !------------------------------------------------------- > : $ C: > : $ ! > : $ goto E > : $ ! > : $ E: > : $ if "TRUE" > : $ then > : $ ! > : $ endif > : $ return ! C > : $ ! > : $ !------------------------------------------------------- > : $ A: > : $ ! > : $ B: > : $ if "TRUE" > : $ then > : $ gosub C > : $ goto B > : $ endif > : $ return ! A > > : Any further reduction of the code removes the problem. > : Ex. try the following: > : - Remove the first if statement and call gosub A directly. > : - Remove the goto E > : - Remove the if statement in the routine C: > : - Remove the if statement in the routine A: > : I solved the problem by interchanging the order of routine A: and C:. > > : The problem exists on VMS 5.5 and 6.2 and both on VAX and AXP. > > : What am I doing wrong ? What is happening here ? > > : Regards Hans-Peter > > : -- > > : Hans-Peter Harpoeth BB & OOO > : SW development B B & & O O Phone : +45 96 84 49 85 > : Bang & Olufsen BBBB && O O or : +45 96 84 11 22 > : Peter Bangs Vej 15 B B & && O O Fax : +45 97 85 59 50 > : DK-7600 Struer B B & && O O email : hph(a)bang-olufsen.dk > : Denmark BBBB && OOO On a related note, something I've found usefull with large DCL procedures is to add a not normally called label (ie "find_dcl_error:") to the end of the procedure. Then, at the beginning of the procedure immediatly gosub find_dcl_error and return. If you receive a target of gosub not found, move the label closer to the beginning of the command procedure. After a few attempts moving the label around you'll be able to determine the start of the block which broke your code. I've had a couple of DCL procedures, which should have been .EXE's (they ended up 4-5000 lines in length) and this helped me find my errors in a matter of seconds or minutes. /T