JAVA CODING EXAMPLES - 4690 Operating System Base
JAVA CODING EXAMPLES - 4690 Operating System Base
JAVA CODING EXAMPLES - 4690 Operating System Base
/* * Class to test access to a 4690 Keyed File from a Java Application * It is written to use an existing file on a shared basis to make sure * the file can be accessed while GSA or SA is also using the file */ /* * Philip Robinson June 1999 * Version 1.0 */ import com.ibm.OS4690.* ; import java.io.* ; class Keyed_File_Access { public static void main(String[] args) { String fileName ; int inchr ; byte[] myRecord = new byte[3000] ; String myKey ; // This try is for ALL the code in the class to catch any errors that may occur try { // Ask for a filename System.out.println("Type a Filename and then press the Enter key") ; // Read user input fileName = "" ; while (true) { inchr = System.in.read() ; if (inchr == 13 || inchr == 10) break ; fileName = fileName + (char)inchr ; } // Show filename user entered System.out.println("\nUsing Filename: " + fileName) ; // Open filename as an existing 4690 Keyed File for shared read access KeyedFile myFile = new KeyedFile(new File(fileName), "r", KeyedFile.SHARED_READ_ACCESS) ; // Display KeyLength and RecordSize System.out.println("\nRecordSize is: " + myFile.getRecordSize()) ; System.out.println("KeyLength is: " + myFile.getKeyLength()) ;
);