perror("open Error"); CleanUpOnError(5); return ð;

}

printf("Opened %s for reading.\n",TEST_FILE);

.7/

/\ Read from the TEST_FILE file, via FilDes, into Buffer. \/ BytesRead = read(FilDes,Buffer,sizeof(Buffer));

if ( -1 == BytesRead )

{

perror("read Error"); CleanUpOnError(6); return ð;

}

printf("Read %s from %s.\n",Buffer,TEST_FILE); if ( BytesRead != BytesWritten )

{

printf("WARNING: the number of bytes read is "\

"not equal to the number of bytes written.\n");

}

.8/

/\ Close the TEST_FILE file via FilDes. \/ if ( -1 == close(FilDes) )

{

perror("close Error"); CleanUpOnError(7); return ð;

}

FilDes = -1;

printf("Closed %s.\n",TEST_FILE);

.9/

/\ Unlink the file TEST_FILE \/ if ( -1 == unlink(TEST_FILE) )

{

perror("unlink Error"); CleanUpOnError(8); return ð;

}

printf("Unlinking file %s.\n",TEST_FILE);

printf("Program completed successfully.\n"); return ð;

}

Using the Integrated File System—ILE COBOL Example

This example program uses the integrated file system from ILE COBOL.

PROCESS NOMONOPRC. IDENTIFICATION DIVISION.

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

\

B-178System API Programming V4R1

Page 456
Image 456
IBM Version 4 manual Using the Integrated File System-ILE Cobol Example, Process NOMONOPRC. Identification Division