1. Introduction ++ ++++++++++++ This note describes a new Open GX Direct Access method for 32-bit which will include all the functionality of the Open direct access method. The access method will require the file path name to be correct and to have the correct slash character for the host o/s. 2. Data ++ ++++ The organisation statement required will be as follows:- ORGANISATION OR$98X TYPE 0 EXTENSION 128 The FD extension will be as follows:- 01 OD 02 FILLER PIC X(2) * Reserved for close update * flag and file number 02 ODCPOS PIC 9(9) COMP * Current file position * (not part of user interface) 02 FILLER PIC 9(4) COMP * Leave unused to be * compatible with open direct 02 ODFNAM PIC X(100) * File name 02 ODHAND PIC 9(9) * Handle * (not part of user interface) 02 FILLER PIC X(4) COMP * Leave unused for * compatiblity with open * direct 02 ODMODE PIC X * Open mode * bit flags * #01 - Read access * #02 - Write access * #04 - Allow shared read * access * #08 - Allow shared write * access * 02 ODTYP PIC X * Open flags * bit flags * #01 - Normal file * #02 - Read only file * #04 - Archive * #08 - Hidden file * #10 - Write trough cache 02 FILLER PIC X(4) * Spare 3. Supported operations ++ ++++++++++++++++++++ The following operations will be supported:- OPEN NEW (1) OPEN OLD (2) CLOSE (3) CLOSE TRUNCATE (4) CLOSE DELETE (5) WRITE NEXT (6) WRITE (7) READ NEXT (8) READ (9) READ PRIOR (12) READ FIRST (13) READ LAST (14) The current block size (ULREC) must be moved to the previous block size (FDBLO) at the end of every read and write operation. 3.1 OPEN NEW ++++++++++++ The OPEN NEW operation will first check the path name for the terminating #00 and return a STOP code if not present. The terminating #00 must be specified by the calling program to avoid having to place it in the file string for every access method operation. The file name may be specified in various forms. As an example; If the GX install directory is C:\GX, the LocalTempDirectory is C:\TEMP and the DTEMP INI file setting is D:\TEMP, then:- Filename Absolute path\file C:\WINDOWS\EXAMPLE C:\WINDOWS\EXAMPLE EXAMPLE C:\GX\EXAMPLE .\EXAMPLE C:\GX\EXAMPLE SUBDIR\EXAMPLE C:\GX\SUBDIR\EXAMPLE $TEMP\EXAMPLE C:\TEMP\EXAMPLE $WINDOWS\EXAMPLE C:\WINDOWS\EXAMPLE $DTEMP\EXAMPLE D:\TEMP\EXAMPLE If ODMODE is not set up (ie set to zero) then the mode will be defaulted to read/write access. If ODTYP is not specified the type will be defaulted to Normal. If the file already exists an exception will be returned. The initial size of the file is 0. It will be extended as needed, subject to available space in the filing system. The file position must be set to start of file on completion, the previous block size must be set to 0, and the file handle must be set up within the FD. The initial file positioning is done automatically by GX. 3.2 OPEN OLD ++++++++++++ The OPEN OLD operation will first check the path name for the terminating #00 and return a STOP CODE if it is not present. File name may be specified as above. If ODMODE is not set up (ie set to zero) then the mode will be defaulted to read/write access. If ODTYP is not specified the type will be defaulted to Normal. It will then attempt to open an existing Window file returning any appropriate errors if failed. The current file size will be returned in the SIZE (ULEXT) field. The file position must be set to the start of file on completion, the previous block size must be set to 0, and the file handle must be set up within the FD. The initial file positioning will be done by GX. 3.3 CLOSE/CLOSE TRUNCATE ++++++++++++++++++++++++ The GX file must be closed. Any errors must be returned. 3.4 CLOSE DELETE ++++++++++++++++ The GX file must be closed and then deleted. 3.5 WRITE NEXT ++++++++++++++ The WRITE NEXT operation must add the previous block size (FDBLO) to the current position (as indicated by the fd field), and write the data block returning any errors. If the file is extended by writing past the current end of file, ULEXT must be updated. 3.6 WRITE +++++++++ The WRITE operation must write the data to the current position (as indicated by the fd field). For this operation the current position would normally be set by the program. If the file is extended by writing past the current end of file, ULEXT must be updated. 3.7 READ NEXT +++++++++++++ The READ NEXT operation must add the previous block size (FDBLO) to the current position and read the data block from that position. 3.8 READ ++++++++ The READ operation must read data of the block size from the current position within the file. 3.9 READ PRIOR ++++++++++++++ The READ PRIOR operation subtracts the current block size from the current record position, and reads the data block from this position. 3.10 READ FIRST +++++++++++++++ The READ FIRST operation sets the current file position to the start of the file, and reads into the data block from this position. 3.11 READ LAST ++++++++++++++ The READ LAST operation subtracts the current block size from the file size and reads from this position. 4. Error Handling ++ ++++++++++++++ STOP and EXIT codes must all begin with 98. (eg STOP WITH 9801 or EXIT WITH #6201). All new STOP and EXIT codes must be entered in the STOP and EXIT code database and added to the end of this document to aid with documentation (unless you are going to produce draft documentation). Try and keep the EXIT codes as compatible as possible with existing access method codes. The following I/O $$COND = 1 error can occur. An error "I" - $$RES = "I" will be returned if a host operating system error occurred. The host error code must always be returned in the system variable field $$CRES. An error "K" - $$RES will be returned if a 'GX' error occurs. The GX error number will be returned in $$CRES. The following GX errors are possible:- Open operations 1 Invalid block version number 2 No file name specified 3 Replaceable parameter not configured Read operations 1 Invalid block version number Write operation 1 Invalid block version number Close 1 Invalid block version number 5. Stop and Exit codes ++ +++++++++++++++++++ 5.1 Stop codes ++++++++++++++ 9807 Operation not supported. 9898 Pathname not null terminated. 9899 Not a GX system. 5.2 Exit codes ++++++++++++++ 9801 Irrecoverable I/O error. 9802 File condition. 9803 Insufficient memory