#pragma module TRNLNM "SRH X1.0-000"

/*
** COPYRIGHT (c) 1992, 1998 BY
** DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS.
** ALL RIGHTS RESERVED.
**
** THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
** ONLY  IN  ACCORDANCE  OF  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
** INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR  ANY  OTHER
** COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
** OTHER PERSON.  NO TITLE TO AND  OWNERSHIP OF THE  SOFTWARE IS  HEREBY
** TRANSFERRED.
**
** THE INFORMATION IN THIS SOFTWARE IS  SUBJECT TO CHANGE WITHOUT NOTICE
** AND  SHOULD  NOT  BE  CONSTRUED  AS A COMMITMENT BY DIGITAL EQUIPMENT
** CORPORATION.
**
** DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE  OR  RELIABILITY OF ITS
** SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
*/

/*
**++
**  Facility:
**
**	Examples
**
**  Version: V1.0
**
**  Abstract:
**
**	Example of working with the $TRNLNM service
**
**  Author:
**	Steve Hoffman
**
**  Creation Date:  1-Jan-1990
**
**  Modification History:
**--
*/
#include <rms.h>
#include <descrip.h>
#include <lnmdef.h>
#include <psldef.h>
#include <ssdef.h>
#include <starlet.h>
#include <stdio.h>
#include <stdlib.h>
#include <stsdef.h>
#define BUFLEN 255
main()
    {
    struct FAB fab = cc$rms_fab;
    struct NAM nam = cc$rms_nam;
    char rsa[NAM$C_MAXRSS];
    int retstat;
    int lnmlength;
    int i;
    char lnmbuf[BUFLEN];
    struct
	{
	short size;
	short code;
	void *addr;
	void *rla;
	} itmlst[5];
    $DESCRIPTOR( sysinput, "SYS$INPUT" );
    $DESCRIPTOR( lnmprocess, "LNM$PROCESS" );

    i = 0;
    itmlst[i].size  = BUFLEN;
    itmlst[i].code  = LNM$_STRING;
    itmlst[i].addr  = lnmbuf;
    itmlst[i++].rla = NULL;
    itmlst[i].size  = sizeof( int );
    itmlst[i].code  = LNM$_LENGTH;
    itmlst[i].addr  = &lnmlength;
    itmlst[i++].rla = NULL;
    itmlst[i].size  = 0;
    itmlst[i].code  = 0;
    itmlst[i].addr  = NULL;
    itmlst[i++].rla = NULL;
   
    retstat = sys$trnlnm( 0, &lnmprocess, &sysinput, &PSL$C_SUPER, itmlst );
    if ( !$VMS_STATUS_SUCCESS( retstat )) return retstat;

    /*
    //	Skip over the channel number -- SYS$INPUT is a system-defined
    //  process-permanent file (PPF), and has a two-byte prefix that
    //  contains an I/O channel number.
    */
    fab.fab$w_ifi = *((unsigned short *) (lnmbuf + 2));
    fab.fab$l_nam = &nam;
    nam.nam$l_rsa = rsa;
    nam.nam$b_rss = 255;

    retstat = sys$display( &fab, 0, 0 );
    if ( !$VMS_STATUS_SUCCESS( retstat )) return retstat;

    return SS$_NORMAL;
    }
