I am new to OpenVMS and am trying to use SYS$FAO for formatting the output, but the function does not return any data in the out buffer and always return 3 in the output length field.
Any help or pointers will be highly appreciated. Please find my below my c code.
#include <lib$routines.h> //code added // for lib$signal
#include <starlet.h> //code added // for RMS function prototypes
#include <stdio.h> //code added // for printf, gets, etc.
#include <string.h> //code added // for strlen
#include <stdlib.h> //code added // for memset
#include <ssdef.h>
#include <devdef.h>
#include <rms.h>
#include <descrip.h>
#include <stsdef.h>
#include <starlet.h>
int main()
{
int status; /* Status of system calls */
int outlen=0; /* Length of output string from $FAO */
//char out_buffer[80]; /* Buffer for $FAO output */
char* out_buffer; /* Buffer for $FAO output */
$DESCRIPTOR(out_desc, out_buffer); /* Descriptor for out_buffer */
$DESCRIPTOR(jones, "Jones");
$DESCRIPTOR(harris, "Harris");
$DESCRIPTOR(wilson, "Wilson");
$DESCRIPTOR(fao_desc, "Unable to locate !3(8AS)!!");
out_buffer = (char*)malloc(sizeof(char)*800);
printf("defined all variables");
status = sys$fao(&fao_desc, /* Control string for $FAO */
&outlen, /* Pointer for length of output string */
&out_desc, /* Descriptor for output buffer */
&jones, /* P1 - ASCII string descriptor */
&harris, /* P2 - ASCII string descriptor */
&wilson); /* P3 - ASCII string descriptor */
printf("sys$fao call is done\n");
/* Immediately signal (and quit) if error occurred */
if ((status & STS$M_SUCCESS) == 0) lib$signal(status);
printf("checked the status returned from sys$fao\n");
printf("Returned Length is %d\n",outlen);
/* FAO directive succeeded, output resultant string */
out_buffer[outlen] = '\0'; /* add string terminator to buffer */
printf("terminated the string \n");
//puts(out_buffer); /* output the result */
printf("out buffer is %s\n",out_buffer);
printf("printed the output on console\n");
free(out_buffer);
return 0;
}
//char out_buffer[80]; /* Buffer for $FAO output */
char* out_buffer; /* Buffer for $FAO output */
$DESCRIPTOR(out_desc, out_buffer); /* Descriptor for out_buffer */
...
out_buffer = (char*)malloc(sizeof(char)*800);
The $DESCRIPTOR macro uses the sizeof() function to fill in the dsc$w_length field, and so is unsuitable for use with char*. If you used the char[] definition of out_buffer, it would have worked.
malmberg August 04 2022 No more VAX hobbyist licenses.
Community licenses for Alpha/IA64/X86_64 VMS Software Inc.
Commercial VMS software licenses for VAX available from HPE.
ozboomer July 20 2022 Just re-visiting.. No more hobbyist licenses? Is that from vmssoftware.com, no 'community' licenses?
valdirfranco July 01 2022 No more hobbyist license...sad
mister_wavey February 12 2022 I recall that the disks failed on the public access VMS systems that included Fafner
parwezw January 03 2022 Anyone know what happened to FAFNER.DYNDS.ORG?
I had a hobbyist account here but can longer access the site.
gtackett October 27 2021 Make that DECdfs _2.1A_ for Vax
gtackett October 27 2021 I'm looking for DECdfs V2.4A kit for VAX.
Asking here just in case anyone is still listening.
MarkRLV September 17 2021 At one time, didn't this web site have a job board? I would love to use my legacy skills one last time in my career.
malmberg January 18 2021 New Hobbyist PAKs for VAX/VMS are no longer available according to reports. Only commercial licenses are reported to be for sale from HPE
dfilip January 16 2021 Can someone please point me to hobbyist license pak? I'm looking for VAX/VMS 7.1, DECnet Phase IV, and UCX/TCPIP ... have the 7.1 media, need the license paks ... thanks!