Article 147894 of comp.os.vms:
: 
>sense of this circular definition, I looked at the definition of the same arg 
>of LIB$FIND_FILE_END, where it is defined as the address of the FAB/NAM buffer 
>from a previous call to LIB$FIND_FILE.  Hence my inference that LIB$FIND_FILE 
>would provide the FAB/XAB info I was looking for if I passed the address of my 
>FAB buffer in the "context" arg.

As others have replied before, LIB$FIND_FILE creates a FAB/NAM/Namebuffers
block (no XAB) and points to it in CONTEXT. You can not pass your own.
You can look at them, but you are not supposed to use them.
As always, if you nicely clean up afteryourself, there is nothing wrong
with 'borrowing' this conveniently set up FAB/NAM. Currently there is
NO XAB hooked up, but just in case one woudl be in some future I would
code it as follows:



/* LIB$FIND_FILE context argument borrowing example by Hein van den Heuvel. */
#include descrip
#include rms
main(int argc, char *argv[])
{
    int	stat, stv, input_dx[2], context = 0, *xab;
    struct dsc$descriptor_d file_name_dx = {0, DSC$K_DTYPE_T, DSC$K_CLASS_D, 0};
    struct FAB *fab;
    struct XABFHC fhc;

    fhc = cc$rms_xabfhc;
    if (argc != 2) return 16;
    input_dx[0] = strlen(argv[1]);
    input_dx[1] = (int) argv[1];
    stat = lib$find_file( &input_dx, &file_name_dx, &context, 0, 0, &stv, 0);
    while (1 & stat) {
	fab = context;
	lib$put_output(&file_name_dx);
	xab = (void *) fab->fab$l_xab;
	fab->fab$l_xab = (void *) &fhc;
	fhc.xab$l_nxt = (void *) xab;	/* just in case */
	stat = sys$open(fab);
	if (!(stat &1)) return stat;
	printf ( "ALQ/EBK/FFB = %d/%d/%d blocks.", 
		 fab->fab$l_alq, fhc.xab$l_ebk, fhc.xab$w_ffb);
	fab->fab$l_xab = (void *) xab;	/* return fab as found */
	sys$close(fab);			/* return fab as found */
	stat = lib$find_file( &input_dx, &file_name_dx, &context,0,0, &stv, 0);
	
	}
    lib$find_file_end ( &context );
    if (stat != RMS$_NMF) return (stat);
}

Hope this helps,		+--------------------------------------+
Hein van den Heuvel, Digital.	| All opinions expressed are mine, and |
  "Makers of VMS and other	| may not reflect those of my employer |
   fine Operating Systems."	+--------------------------------------+


