! ----- LOGICAL_NAME.FUN ----- ! ! ----- FUNCTION TO TRANSLATE A LOGICAL NAME ----- ! ! ---------- PASSED: ---------- ! ! ----- NAME_TO_BE_XLATED = LOGICAL NAME TO BE TRANSLATED ----- ! ! ---------- RETURNED: ---------- ! ! ----- LOGICAL_NAME = FUNCTION RETURNS SS$_NORMAL IF SUCCESSFUL ----- ! ----- SS$_NOLOGNAM IF NO LOGICAL ----- ! ----- SS$_ABORT IF ANY OTHER ERROR --- ! ! ----- TRANSLATED_NAME = IF FUNCTION RETURNS SS$_NORMAL: ----- ! ----- EQUIVALENCE NAME (BLANK IF NO TRANSLATION) ----- ! ! ----- Last Change 07/02/93 by Brian Lomasky ----- ! FUNCTION LONG LOGICAL_NAME(STRING NAME_TO_BE_XLATED, & STRING TRANSLATED_NAME) %INCLUDE "NUSER.INC" %INCLUDE "$LNMDEF" %FROM %LIBRARY "SYS$LIBRARY:BASIC$STARLET.TLB" RECORD TRNBUF ! $TRNLNM RECORD WORD BUFFER_LENGTH1 WORD ITEM_CODE1 LONG BUFFER_ADDRESS1 LONG RETURN_LENGTH_ADDRESS1 LONG LIST_TERMINATOR END RECORD TRNBUF DECLARE LONG LOCAL_STATUS ! LOCAL SYSTEM SERVICE EXIT STAT DECLARE WORD LOG_LENGTH ! LENGTH OF LOGICAL NAME DECLARE TRNBUF TRNITEM ! EQUATE $TRNLNM RECORD ! ----- TRANSLATE LOGICAL NAME ----- EXTERNAL LONG FUNCTION SYS$TRNLNM ! ----- LOGICAL NAME FROM $TRNLNM ----- MAP (TRNLNM) STRING LOG_NAME = 255% TRNITEM::BUFFER_LENGTH1 = 255% ! STORE DATA FOR $TRNLNM TRNITEM::ITEM_CODE1 = LNM$_STRING TRNITEM::BUFFER_ADDRESS1 = LOC(LOG_NAME) TRNITEM::RETURN_LENGTH_ADDRESS1 = LOC(LOG_LENGTH) TRNITEM::LIST_TERMINATOR = 0% LOCAL_STATUS = SYS$TRNLNM(, "LNM$DCL_LOGICAL", & NAME_TO_BE_XLATED, , TRNITEM) SELECT LOCAL_STATUS CASE SS$_NOLOGNAM ! IF NO LOGICAL EQUIVALENT: TRANSLATED_NAME = "" LOGICAL_NAME = LOCAL_STATUS CASE SS$_NORMAL ! ----- EXTRACT LOGICAL NAME ----- IF LOG_LENGTH > 0% THEN ! ----- EXTRACT EQUIVALENCE NAME ----- TRANSLATED_NAME = LEFT(LOG_NAME, LOG_LENGTH) LOGICAL_NAME = LOCAL_STATUS ELSE PRINT PRINT "ERROR - INVALID LOGICAL NAME: " & + NAME_TO_BE_XLATED PRINT "Notify your VAX System Manager" + BEL LOGICAL_NAME = SS$_ABORT END IF CASE ELSE PRINT PRINT "UNEXPECTED TRNLNM ERROR: "; LOCAL_STATUS PRINT "WHILE TRYING TO TRANSLATE LOGICAL" + & " NAME: " + NAME_TO_BE_XLATED PRINT "Notify your VAX System Manager" + BEL LOGICAL_NAME = SS$_ABORT END SELECT END FUNCTION