dick scherrer wrote:...
what would happen if you collect all the input lines in a huge buffer and then print all of them at once
You don't do that in z/OS. Your code needs to adapt to the new environment.
From the
XL C/C++ Run-Time Library Reference chapter for the fputs function -
For a text file, truncation may occur if the record is too long. Truncation means that excess characters are discarded after the record is full, up to a control character that ends the line (\n). Characters after the \n start at the next record. For more information, see the section on "Truncation" in z/OS XL C/C++ Programming Guide. (my emphasis)
Dick and zatlas: I think what zatlas is describing is supposed to work - I think - as zatlas appears to be thinking it should work. I wrote the following little program -
#include <stdlib.h>
#include <stdio.h>
int main( int argn, char *dataset??( ??) )
{
char *astring = "Line 1\n"
"Line 2\n"
"Line 3\n";
FILE *f;
if ( argn < 2 )
printf( "writevb file\n" );
else
if ( ( f = fopen( dataset??( 1 ??), "w" ) ) == NULL )
printf( "I cannot open %s\n", dataset??( 1 ??) );
else
{
fputs( astring, f );
fclose( f );
}
return 0;
}
The output dataset (which was defined with DCB=(RECFM=VB,LRECL=255,DSORG=PS)) contained 3 logical records when I ran it in batch. I also ran the load module in TSO with the output dataset directed to the terminal, and it produced 3 lines.
Dick: I'm inclined to agree this is not great programming style for z/OS, but the manual and direct experimentation seem to agree it should work as zatlas thinks it should.