/* Collection of code snippets by Arne Vajhøj */
/* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) */
#include <stdio.h>
#include <string.h>
#include <rms.h>

#define RME$C_SETRFM 0x00000001

int sys$open();
int sys$modify();
int sys$close();

void stmlf(char *s)
{
   int stat;
   struct FAB myfab = cc$rms_fab;
   myfab.fab$b_fac = FAB$M_PUT;
   myfab.fab$l_fop |= FAB$M_ESC;
   myfab.fab$l_ctx |= RME$C_SETRFM;
   myfab.fab$l_fna = s;
   myfab.fab$b_fns = strlen(s);
   stat = sys$open(&myfab,0,0);
   printf("stat=%d\n",stat);
   myfab.fab$b_rfm = FAB$C_STMLF;
   stat = sys$modify(&myfab,0,0);
   printf("stat=%d\n",stat);
   stat = sys$close(&myfab,0,0);
   printf("stat=%d\n",stat);
   return;
}

main()
{
   stmlf("z.z");
}
