/* */ arg target map_fn map_ft '(' debug If map_fn = '' Then map_fn = 'CMSLOAD' map_ft = Strip(map_ft) If map_ft = '' Then map_ft = 'NUCMAP' NUMERIC DIGITS 10 /* Needed 'cause x'FFFFFFFF' > 999,999,999 */ target = Strip(target) If target = '' Then Exit 1234 /* There are three ways I could be called. The three cases are */ /* 1 - I said WHEREIS from XEDIT, but I'm not XEDITing the load map. */ /* 2 - I invoked the WHEREIS EXEC (with a stacked WHEREIS). */ /* 3 - I said WHEREIS while XEDITing the load map. */ 'EXTRACT /LINE/CURLINE/FN/FT/FM' If rc ^= 0 Then exit rc If fname.1 ^= map_fn | ftype.1 ^= map_ft Then Do 'XEDIT' map_fn map_ft '(NOPROFILE' If rc ^= 0 Then exit rc case = 1 End Else If curline.1 = 'M' Then case = 2; Else case = 3 If case = 3 Then 'PRESERVE' If Debug = '' Then 'SET MSGMODE OFF' /* Ignore bad LOCATE err msgs */ 'TOP' 'NEXT' If rc ^= 0 Then Do /* Abort if this load map is null. */ mymsg = map_fn map_ft 'is empty.' Signal Give_msg_and_quit End If debug ^= '' Then Trace 'I' If Datatype(target,'X') Then Do /* Is target a hex address? */ /* The new HCPLDR loader (the one you use for CMS 5.5 and XA) */ /* has a larger address field, 8 characters instead of 6. So, */ /* determine which kind of map we gots, and do the right thing. */ 'ZONE 16 20' 'LOCATE / AT ' If rc^=0 Then Exit rc 'EXTRACT /CURLINE' Parse var curline.3 . . address . Address_Length = length(address) 'ZONE 20' 20+Address_Length-1 target_address = Right(target,Address_Length,'0') 'LOCATE /'target_address If rc = 0 Then Do /* User gave me an address that's in the map. */ 'EXTRACT /CURLINE' Parse var curline.3 entry_point_name . . . . . length . 'ZONE 2 6' 'LOCATE -/READ /' If rc ^= 0 Then exit rc 'EXTRACT /CURLINE' Parse var curline.3 with 8 module_name 16 . mymsg = target 'is the' strip(entry_point_name) , 'entry point in' strip(module_name)'.' If length ^= '' Then Do length = Strip(length,'L','0') If length = '' Then length = 0 mymsg = mymsg ' Module length =' length'.' End End Else Do /* We get here if the 'LOCATE /'target_address up above */ /* failed. We know that the target is a hex address, but */ /* that address isn't an exact entry point. See if it's */ /* inside a module and if it is, give the offset. */ 'TOP' FoundIt = 0 Endofmap = 0 Do Until FoundIt | Endofmap 'ZONE 2 6' 'LOCATE /READ /' If rc ^= 0 Then Endofmap = 1 Else Do 'EXTRACT /CURLINE' Parse var curline.3 with 8 module_name 16 . 'ZONE 32 46' 'LOCATE /MODULE SIZE IS /' If rc ^= 0 Then Endofmap = 1 Else Do 'EXTRACT /CURLINE' Parse var curline.3 . . start . . . length . If x2d(start) <= x2d(target) & , x2d(start) + x2d(length) > x2d(target) Then FoundIt = 1 End End End If Endofmap Then mymsg = target 'not found in' map_fn strip(map_ft)'.' Else mymsg = target 'is at' strip(module_name) '+' , d2x(x2d(target) - x2d(start))'.' End End Else Do /* The target isn't a hex number, is it an entry point? */ 'ZONE 8 19' 'LOCATE /'Left(Target,8) 'AT ' If rc = 0 Then Do 'EXTRACT /CURLINE/' Parse var curline.3 . . starting_address . . . length . starting_address = strip(starting_address,'L','0') If starting_address = '' Then starting_address = 0 mymsg = target 'is at' starting_address If length = '' Then mymsg = mymsg'.' Else Do length = strip(length,'L','0') If length = '' Then length = 0 mymsg = mymsg 'for' length 'bytes.' End End Else Do /* The target is not an entry point in this load map, but */ /* it could be a module name with different entry points. */ /* A case in point is the DMSACF module in CMS. The only */ /* entry point is READFST, but the module name is DMSACF. */ /* Since we didn't find an entry point by this name, look for */ /* a module by this name before we give up. */ 'TOP' 'ZONE 8 15' 'LOCATE /'Left(Target,8) If rc ^= 0 Then mymsg = target 'not found in' map_fn strip(map_ft)'.' Else Do 'ZONE 16 19' 'LOCATE / AT ' If rc^=0 Then Exit rc 'EXTRACT /CURLINE/' Parse var curline.3 . . starting_address . . . length . starting_address = strip(starting_address,'L','0') If starting_address = '' Then starting_address = 0 mymsg = target 'is at' starting_address If length = '' Then mymsg = mymsg'.' Else Do length = strip(length,'L','0') If length = '' Then length = 0 mymsg = mymsg 'for' length 'bytes.' End End End End Give_msg_and_quit: /* Output our message depending on how we were called. Also if */ /* need be, restore the previous XEDIT environment. */ Select When case = 1 Then Do 'QUIT' 'XEDIT' fname.1 ftype.1 fmode.1 /* Return to original file. */ 'MSG' mymsg End When case = 2 Then Do 'QUIT' Say mymsg End Otherwise Do 'SET MSGMODE ON' 'MSG' mymsg 'RESTORE' If line.1 = -1 Then 'TOP';Else ':'line.1 End End