[comp.os.vms] lib$sys_trnlog

johnny@hurratio.tde.lu.se (Lars Svensson) (01/18/88)

[ I'm posting this for a friend. Reply to him, not to me. /JOHNNY ]

==================================================================

This is a very simple program that shows how to use LIB$SYS_TRNLOG
from a PASCAL program.

I couldn't find the original question about this matter so therefore
I post it to the newsgroup. 

I really hope it solves the original question i.e. the program will
give you any hints.


Thomas Nilsson
Ericsson Radio Systems AB
Sweden

Address: mtk_tnn@kiera.ericsson.se



============= Cut =========== 8< ============= 8< ============= 8< =======

                                  
(* You don't need to inherit this file if you replace SS$_NORMAL below
   with there correct value ...
   But doing it gives a more transportable source *)

[inherit ('SYS$LIBRARY:STARLET')]                   


program test(input,output);                

        type 
                word_integer  =      [word,hidden]   0..65535;
                byte_integer   =     [byte,hidden]   0..255;

        var     log_trans    : varying [132] of char;
                return       : unsigned;

                    
        [external] function LIB$SYS_TRNLOG (
                   logical_name   :  packed array [a..b : integer] of char;
                   var dst_len    :  word_integer := %immed 0;
                   var dst_str    :  packed array [c..d : integer] of char;
                   var table      :  byte_integer := %immed 0; 
                   var acc_mode   :  byte_integer := %immed 0;
                   dsb_msk        :  byte_integer := %immed 0): unsigned;
                                                                extern;
                     
begin

   (* replace SYS$LOGIN with the loglcal you want translated ! *)

   return:=lib$sys_trnlog (
           logical_name:='SYS$LOGIN',
           dst_len:=log_trans.length,
           dst_str:=log_trans.body);
   if return <> SS$_NORMAL then

      (* This means that the logical isn't defined *)

      writeln('Logical isn''t defined .')

   else
      
      writeln('Logical translation is ',log_trans);

end.