Hi Bill !
Through trial and error and the use of perror("dd:OUTF"); I have
determined that this syntax works as expected.
outf = fopen("dd:OUTF", "w");
Thanks for the lead.
Regards
Lorne
Bill Godfrey wrote:
On Fri, 6 Mar 2009 21:29:17 -0500, Lorne Dudley wrote:
I'm a novice trying to get a simple C program running under MVS.
I'm attempting to get file output to
//OUTF DD SYSOUT=A
with the following program.
#include <stdio.h>
int main(void)
{
FILE *outf = NULL;
printf("TESTFILE has been entered.\n");
outf = fopen("dd:OUTF","recfm=fba, w+");
if (!outf)
{
perror("dd:OUTF");
printf("fopen error on FILE *outf.\n");
return 4;
}
fprintf(outf, "outf open ...\n");
fclose(outf);
return 0;
}
So far, with many variations to the fopen string, I get only the
following output on SYSPRINT, no output to OUTF.
TESTFILE has been entered.
fopen error on FILE *outf.
Can anyone give me some advice on how to code this correctly ?
The "perror" function might give you more information about why fopen is
failing. See above.
Bill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html