/* 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>
#include <starlet.h>
#include <ssdef.h>

int main(int argc, char *argv[])
{
   struct FAB myfab = cc$rms_fab;
   myfab.fab$l_fna = argv[1];
   myfab.fab$b_fns = strlen(argv[1]);
   SYS$OPEN(&myfab,0,0);
   SYS$CLOSE(&myfab,0,0);
   switch(myfab.fab$b_org) {
      case FAB$C_SEQ:
         printf("sequential");
         switch(myfab.fab$b_rfm) {
            case FAB$C_VAR:
               printf(" variable\n");
               break;
            case FAB$C_STM:
               printf(" stream\n");
               break;
            case FAB$C_STMLF:
               printf(" stream LF\n");
               break;
            case FAB$C_STMCR:
               printf(" stream CR\n");
               break;
            case FAB$C_VFC:
               printf(" VFC\n");
               break;
            case FAB$C_FIX:
               printf(" fixed\n");
               break;
            case FAB$C_UDF:
               printf(" undefined\n");
               break;
         }
         break;
      case FAB$C_REL:
         printf("relative\n");
         break;
      case FAB$C_IDX:
         printf("index sequential\n");
         break;
   }
   return SS$_NORMAL;
}
