



  Here is the code for set_symbol and set_logical with a little test program to
show how they work

#include <lnmdef.h>
#include <descrip.h>
#include <ctype.h>
#include <string.h>

int set_symbol(char * symbolname, char * value)
{
	int	stat;
	struct	dsc$descriptor sym_name = 
                {strlen(symbolname), DSC$K_DTYPE_Z, DSC$K_CLASS_S, symbolname};
	struct	dsc$descriptor sym_value = 
                {strlen(value), DSC$K_DTYPE_Z, DSC$K_CLASS_S, value};
        int table_type = 1;

        stat = LIB$SET_SYMBOL(&sym_name, &sym_value, &table_type);

        return stat;
}

int set_logical(char * logname, char * value)
{

	int	stat;
	struct	dsc$descriptor lognam = 
                {strlen(logname), DSC$K_DTYPE_Z, DSC$K_CLASS_S, logname};
	struct	dsc$descriptor log_value = 
                {strlen(value), DSC$K_DTYPE_Z, DSC$K_CLASS_S, value};

	stat = LIB$SET_LOGICAL(&lognam, &log_value);
        return stat;
}

---------------------------- A test program

#include <stdio.c>
#include <stdlib.c>
#include "set_sym.h"

int main(int argc, char * argv[])
{

  int res;

  res = set_symbol("TEST_SYMBOL","TEST_SYMBOL_VALUE");
  if (res&1 == 0) {
    fprintf(stderr,"set_symbol didn't work - result = %d\n", res);
  }
  res = set_logical("TEST_LOGICAL","TEST_LOGICAL_VALUE");
  if (res&1 == 0) {
    fprintf(stderr,"set_logical didn't work - result = %d\n", res);
  }

  return 1;
}

