Performing fopen("DD:INTRDR", ...) does not necessarily require the use of dynamic allocation; a "file name" DD:dd name directs fopen to use an existing DD statement with the specified DD name; the JCL used to run the program might specify
//INTRDR DD SYSOUT=A,DCB=(RECFM=F,LRECL=80,BLKSIZE=80)
Of course, your program could use MVS dynamic allocation to allocate the internal reader and then use fopen to open the data set that was just allocated.
As Mr. Sorichetti says, writing -
FILE *infile, *intrdr;
char record[ 81 ];
if ( ( infile = fopen( "input", "r" ) ) == NULL )
printf( "Unable to open input\n" );
else
{
if ( ( intrdr = fopen( "DD:INTRDR", "w" ) ) == NULL )
printf( "Unable to open INTRDR\n" );
else
{
while( fgets( record, sizeof( record ), intrdr ) != NULL )
fputs( record, intrdr );
fclose( intrdr );
}
fclose( infile );
}
when you can use a simple utility such as IEBGENER seems like overkill, but ...