| Hi,
Here'a a BASIC program which translates logical names and which
should cater for search lists. Basically, it calls $TRNLNM
repeatedly for increasing values of the LNM$_INDEX item code
until the length is returned as zero.
Hope it's of some help.
Ian M UK TSC
1 ! trn - translates logical names.
option type = explicit
external long function sys$trnlnm
external word constant lnm$_string, lnm$_index, &
lnm$_length, lnm$_attributes
declare word w_namlen, &
long w_index, &
long w_len, &
long w_stat, &
string w_log
declare integer constant w_true = -1
map (w_buf) string w_eqv = 255
record item_list
word buffer_length_1
word item_code_1
long buffer_address_1
long return_length_address_1
word buffer_length_2
word item_code_2
long buffer_address_2
long return_length_address_2
word buffer_length_3
word item_code_3
long buffer_address_3
long return_length_address_3
long terminator
end record item_list
declare item_list w_items
w_items::buffer_length_1 = 4%
w_items::item_code_1 = lnm$_index
w_items::buffer_address_1 = loc(w_index)
w_items::return_length_address_1 = 0%
w_items::buffer_length_2 = 255%
w_items::item_code_2 = lnm$_string
w_items::buffer_address_2 = loc(w_eqv)
w_items::return_length_address_2 = loc(w_namlen)
w_items::buffer_length_3 = 4%
w_items::item_code_3 = lnm$_length
w_items::buffer_address_3 = loc(w_len)
w_items::return_length_address_3 = 0%
w_items::terminator = 0%
get_logical:
linput "Logical name to translate "; w_log ! Ask for logical.
goto 32767 if len(w_log) = 0% ! Abort if nothing.
w_log = edit$(w_log, 32%) ! Convert to up-case.
w_index = 0% ! Start at bottom.
while w_true
w_stat = sys$trnlnm (, 'LNM$PROCESS_TABLE', &
w_log, , w_items)
! Translate logical
! for current value
! of index.
if (w_stat and 1%) <> 1% then
call lib$signal(w_stat by value)
goto 32767 ! Signal errors.
else
! Continue translating until the length
! is returned as zero.
if w_len <> 0% then
print "Index "; w_index; &
" translation of "; w_log; " is "; w_eqv
else
goto 32767
end if
end if
w_index = w_index + 1%
next
32767 end
|