/* find address of global symbol for PL/I symbolic debugger */ global_address: procedure(aname, asegment) returns(fixed bin(15)/*address in user task*/); dcl aname char(*) varying, asegment fixed bin(23); /*fileaddr of overlay segment hash record for the segment the global must be in*/ %include 'workdef.pli'; %include 'mapdef.pli'; %include 'external.inc'; %include 'truefalse.inc'; dcl trim entry(char(*) varying) returns(char(132) varying), octbin entry(char(*)) returns(fixed bin(15)); dcl mapline char(133) varying static, /*static so takes space from overlay rather than auto which is in root*/ i fixed bin(15), aname6 char(6) varying; /**************************************************************************************************************/ aname6 = aname; call upcase(aname6); call trnslt(aname6, '.', '_'); /*convert underscores to dots*/ on endfile(mapfile) goto return_not_found; do while(true); call workgrab(asegment, scratch_workp); read file(workfile) into(segment_data); if segment_globals_base ^= null_fileaddr then do; call posfile(mapfile, segment_globals_base); /*position to beginning of globals section*/ /* repeat */ name_loop: read file(mapfile) into(mapline); mapline = ' '!!mapline; /*for index to match first symbol of line*/ i = index(mapline, ' '!!aname6!!' '); /* until i ^= 0 */ if i = 0 then goto name_loop; return( octbin(substr(mapline, i+8, 6)) ); end; /*segment globals section not encountered yet - have external_address scan the map for it:*/ i = external_address(any_name, global_class, any_parent); end; /*should only loop back once*/ return_not_found: return(not_found); end/*global_address*/;