Hi Bill (or any other C programmer) !

OK, perror("dd:OUTF"); gives me

EDC5057I The open mode string was invalid. Explanation: The mode string passed to the fopen()/freopen() function was found to have invalid keywords, combinations, or characters. For example, if you are opening a ddname, be sure the DISP= specified on the DD statement is compatible with the open mode you specified. Programmer response: Correct the mode string and reissue the fopen()/freopen().

I'm not much wiser with this explanation.

I know that if I use only
outf = fopen("dd:OUTF","w+");
and
//OUTF DD DISP=OLD,DSN=SYS2#.C.OUTF

the program executes properly with zero return code.
In this case the OUTF file is on disk with recfm=vb, lrecl=1028, blksize=6144.

So I'm still in the dark as to how to get this to write to SYSOUT=A.

Regards

Lorne

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 [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to