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

static struct FAB *myfab;
static struct RAB *myrab;

static int acc_cb(int *first_arg, struct FAB *fab, struct RAB *rab)
{
    myfab = fab;
    myrab = rab;
    return 0;
}

int main(int argc, char *argv[])
{
    int dummy = 0;
    FILE *fp = fopen("z.z", "w", "acc", acc_cb, &dummy);
    fprintf(fp, "%s\n", "A");
    char *s = "BB";
    myrab->rab$l_rbf = s;
    myrab->rab$w_rsz = strlen(s);
    long stat = sys$put(myrab, 0, 0);
    fprintf(fp, "%s\n", "CCC");
    fclose(fp);
}
