Home · Articles · Downloads · Hobby Wear · Forums · Web Links · News CategoriesSaturday, April 20, 2024
Navigation
Home
Articles
Downloads
Hobby Wear
FAQ
Forums
Web Links
News Categories
Contact Us
Photo Gallery
OpenVMS Bigot
Search
Users Online
Guests Online: 7
No Members Online

Registered Members: 7,708
Newest Member: nifseg
Sponsors
Island Computer
View Thread
OpenVMS Hobbyist Program | Hobbyists and OpenVMS | How I Use OpenVMS
Author Usage of SYS$FAO
akm
Member

Posts: 3
Joined: 22.06.09
Posted on June 22 2009 23:11
Hi,

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;
}
Author RE: Usage of SYS$FAO
martinv2
Member

Posts: 107
Location: Goslar, Germany
Joined: 02.10.07
Posted on June 27 2009 16:26
//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.

Alternatively, reset the field like
out_desc.dsc$w_length = 800-1;




HTH,
Martin


http://de.openvms.org/martinv/
http://de.openvms.org/martinv/
Author RE: Usage of SYS$FAO
akm
Member

Posts: 3
Joined: 22.06.09
Posted on June 29 2009 03:21
Hi All,

thanks for the help.
Jump to Forum:
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Member Poll
Are you going to OpenVMS Boot Camp 2016?

Yes

No

You must login to vote.
Shoutbox
You must login to post a message.

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!

Bart
October 16 2020
OpenVMS, and this website!

malmberg
September 05 2020
VSI community non-commercial licenses for AXP/IA64 are available now.

malmberg
September 05 2020
See the forum about licensing. Don't know if HPE hobby licenses still being issued. Commercial licenses still being sold.

silfox70
September 01 2020
I need the license for OpenVMS7.3. Where can I find them?

malmberg
August 29 2020
Eisner, which is currently being moved, got an SSH update and the keys were updated to more modern encryption standards.

Shoutbox Archive