 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT or COMPONENT: VER_3.1_PLI OP/SYS: VER_5.0_VMS
SOURCE: Digital Customer Support Center
OVERVIEW:
This program demonstrates how to use the Translate Logical Name ($TRNLNM)
system service.
CAUTION: This sample program has been tested using:
PRODUCT: PL1 V3.1 on OPERATING SYSTEM: VMS V5.0
However, we cannot guarantee its effectiveness because of the possibility of
errors in transmitting or implementing it. It is meant to be used as a
template for writing your own program, and it may require modification for
use on your system.
PROGRAM SAMPLE:
/* This program will translate a predefined logical name called COMMON$.
It may be in any of the process, job, group or system tables. */
TRNLNM: procedure options(main);
%include SYS$TRNLNM;
%include $ssdef;
%include $stsdef;
%include $lnmdef;
/* Trnlnm is case specific, field names should not have the VARYING
attribute */
/* logical name to be translated*/
dcl lognam char(7) static init('COMMON$');
/* logical name tables searched */
dcl nametab1 char(17) static initial('LNM$PROCESS_TABLE');
dcl nametab2 char(13) static initial('LNM$JOB_TABLE');
dcl nametab3 char(16) static initial('LNM$SYSTEM_TABLE');
dcl nametab4 char(15) static initial('LNM$GROUP_TABLE');
dcl nametab5 char(12) static initial('LNM$FILE_DEV');
/* results from the call*/
dcl 1 item_list,
2 buffer_length fixed binary(15) initial(255),
2 item_code fixed binary(15) initial(lnm$_string),
2 buffer_address pointer,
2 return_length_address pointer,
2 terminator fixed binary(31) initial(0);
dcl buffer character(255) init(' ');
dcl return_length fixed binary(15);
/* The next 4 calls demonstrate how call the 4 standard logical name
tables separately. */
buffer_address = addr(buffer);
return_length_address = addr(return_length);
sts$value = SYS$TRNLNM(,nametab1,lognam,,item_list);
if sts$success
then put skip list (lognam,' is ', substr(buffer,1,
return_length), ' in ',nametab1);
else IF sts$value ^= ss$_nolognam
then signal vaxcondition(sts$value);
sts$value = sys$trnlnm(,nametab2,lognam,,item_list);
if sts$success
then put skip list (lognam,' is ', substr(buffer,1,
return_length), ' in ',nametab2);
else if sts$value ^= ss$_nolognam
then signal vaxcondition(sts$value);
sts$value = sys$trnlnm(,nametab3,lognam,,item_list);
if sts$success
then put skip list (lognam,' is ', substr(buffer,1,
return_length), ' in ',nametab3);
else if sts$value ^= ss$_nolognam
then signal vaxcondition(sts$value);
sts$value = sys$trnlnm(,nametab4,lognam,,item_list);
if sts$success
then put skip list (lognam,' is ', substr(buffer,1,
return_length), ' in ',nametab4);
else IF sts$value ^= ss$_nolognam
then signal vaxcondition(sts$value);
if buffer = ' '
then do;
put skip file(sysprint) list
('The following tables were searched for ',lognam,':');
put skip file(sysprint) list (nametab1);
put skip file(sysprint) list (nametab2);
put skip file(sysprint) list (nametab3);
put skip file(sysprint) list (nametab4);
put skip(2) file(sysprint) list('Logical Name was not found');
end;
/* This last call duplicates how DCL or RMS would translate the logical
name. It does one call using LNM$FILE_DEV to translate the name*/
put skip list('DCL conversion:');
sts$value = sys$trnlnm(,nametab5,lognam,,item_list);
if sts$success
then put skip list (lognam,' is ', substr(buffer,1,
return_length), ' in ',nametab4);
else IF sts$value ^= ss$_nolognam
then signal vaxcondition(sts$value);
put skip file(sysprint) list ('***PROCESSING COMPLETE***');
end TRNLNM;
|
buy online or call 1.800.AT.COMPAQ
|
|