File I/O support
Note, this is much more general than what OS permits:
The simulator will deal with either entry or name sequence collections where possible and treat those few cases were named sequence collections are required as OPEN failures.
With the standard byte stream {(p3,sbs)} protocol, one co-routine call is made for each OS record. The OS record is stripped of all trailing blanks and a new-line character is appended. Standard byte streams closely resemble UNIX pipes and are specifically designed to communicate with terminals. The connection of a domain with a terminal via a user defined co-routine is not possible at this time.
With the standard record stream (p3,srs) protocol each co-routine call transmits 1 OS record without modification (the record is first converted into a standard Gnosis record which is variable length and unblocked). As with record collections padding and truncation take place on input but attempts to write records larger than the consumer is willing to accept results in a SYNAD. Since the simulator interface with co-routines sets up a consumer that will accept 4096 bytes, this is not a problem when connecting two OS programs.
With the standard blocked record stream (p3,sbrs) protocol multiple OS records are blocked until the total co-routine buffer is filled. Each logical record is preceded by a halfword length. Although a logical record may span co-routine calls, the simulator generates no such records unless the logical record will not fit on one page (see section on long records). Because of the blocking this is the most efficient of the three protocols. However, since the transmission of a record will not occur unless a buffer is full, it should not be used in situations were the results of an operation need to be immediately apparent to a user (i.e., records come in bunches after long delays. A message may get stuck in a buffer for a long time).
In Gnosis each member is a separate record collection {only record collections are created by the simulator but a member may be any Gnosis data structure} and the directory is a separate record collection that is exactly like a Gnosis "directory". In this way each member may be treated separately with any OS access method {even ISAM can be used, though when the member is read as part of a PDS the keys will be stripped and the file will be accessed sequentially} and treated as an aggregate as a PDS. This unusual treatment leads mostly to advantages as any Gnosis facility can be applied to members of a PDS without knowledge that it is in fact a member of a PDS. Catalogs can be processed by OS programs as if they were PDS's. Dissimilar things can be assembled together as a PDS.
Tapes may not be members of a PDS.
However, some OS programs will not work on PDS's as defined in Gnosis. Programs that read the directory {IEHMOVE, IEBCOPY, etc.} will not work. There is at present no way to have an ALIAS since OS treats the TTR of a member as its "true name" and there is no equivalent in Gnosis. The only practical program that will fail is the OS link editor. It is not likely that this will pose a long term problem.
In OS BDAM is very dependent on the behavior of Count, Key, Data disk devices. Each track represents an area similar to a VSAM control interval and can contain multiple records with keys. Several tracks can have records with the same key though keys must be unique within a track. In Gnosis the key is combined with the TTR to simulate this behavior. The TTR used by the simulator is calculated based on the Record per Track information that is supplied by the DEVTYPE macro. In Gnosis all simulated devices are 3330's. Since the number of records per track is dependent on the record size, the user must not change this parameter between uses of the file. This is consistent with usage in OS. There is a certain amount of overhead involved in this approach and keyed BDAM should be avoided.
Non-keyed fixed format files can be mapped into either Named or Entry Sequence record collections. The Block Number supplied by the application program is simply the Gnosis record number. In Named Sequence collections each block is simply written as a record with the block number as the name. In Entry Sequence collections the missing records are filled in as needed with dummy records so that the record written will have the correct record number. Records that are longer than 4091 bytes require very special treatment in BDAM and will be discussed here. For a complete discussion of long records see the section Long Records. With Named Sequence collections records cannot exceed 4087 bytes. With Entry Sequence collections records can be up to 32767 bytes in length and therefore will span several Gnosis records. In this case the record number will be a fixed multiple of the block number. Since all blocks are of the same length all OS operations are preserved.
Keyed fixed format files can be mapped only into Named Sequence collections. Here the Block Number supplied by the application program corresponds to a disk TTR that is the nominal place to write the record. If the TTR is currently empty (contains a dummy record) the record is written there. If the TTR is in use the next available one is used. In Gnosis the TTR is appended to the key and a unique name is generated. If there is a name in the collection with this TTR as its beginning (determined by searching on a 3 byte name) then the TTR is incremented to the next valid value (Gnosis simulates 3330 devices) and the first available TTR is used.
Keyed variable format files can only be mapped into Named Sequence collections. Here the Block Number supplied by the application corresponds to a track number and the first available TTR on that track is used for the record. As in fixed format files the TTR is added to the beginning of the name and a short key read is used to find the first unused TTR on the track. If the track is full the next track is used.
Logical records and Blocked Records
The Gnosis record collection protocols support logical records of approximately 1 page in length. For Entry Sequence collections the maximum record is 4091 bytes as 5 bytes are required for record identifier. Name Sequence collections support records of 4095 bytes minus the length of the name. When sequential non-keyed records are mapped into Name Sequence collections, the OS simulator generates an 8 byte name so the maximum record length is 4087 bytes.
Longer records are supported only with Entry Sequence collections and co-routines. Attempts to support long records with Name Sequence collections would destroy the "sticky line number" concept. With Entry Sequence collections logical records up to 65535 bytes are supported by breaking each logical record into 4087 byte chunks each preceded by a record control word. The first chunk has a control word that contains the length of the logical record, the middle chunks contain control words of zero, and the last chunk contains a control word with the left most bit on. If the record is in fact 4087 bytes or less the first word will contain the length and have the left most bit on. For co-routines the record is simply sent with as many co-routine calls as necessary. Either byte stream or block record streams can be used.
The information that a record collection contains long logical records is in the record collection user data area. The first 4 bytes of the user data contain flags describing various attributes of the collection that might interfere with standard processing
With the exception of BDAM all logical records stored in Gnosis data structures are unblocked. The BSAM simulation module contains code that unblocks the user records on output and provides short blocks on input. QSAM is normally entered once for each logical record and unblocking is not necessary. Since PL/I run time libraries attempt to cut down on QSAM overhead by blocking records based on information in the DCB, the simulator maintains that information so that PL/I believes the block is always full. For BDAM blocks are written as provided by the user as there is no Gnosis facility that can process these records. For ISAM files blocking is prohibited except for fixed block 1 record per block (required by COBOL). Attempts to open an ISAM file with blocking will result in an OPEN failure.
High performance data transfer that takes advantage of blocking can be achieved by using blocked record co-routines (p3,sbrs).
Spanned Records
For BSAM spanned records it is necessary to include a span byte with each record. This byte is normally part of the OS "green word" but Gnosis does not have this spare byte as part of the record length. For spanned records a byte is added to the beginning of the OS record and the OS record plus span byte is transmitted to the Gnosis data structure (record collection or co-routine). There is a flag bit in the record collection user data describing this condition.
Deleted records do not exist, and cannot be read. OPTCD=L is assumed for all operations for which deleted records are allowed. Fixed records with RKP=0 and Variable records with RKP=4 may not have deleted records. {This restriction was carried over from OS for consistency.}
DCB parameters are filled in in much the same was as in OS. The simulator keeps information about the last use of a file in the user data portion of the record keeper. This information corresponds to the DCSB of OS and can be used to specify fully the DCB information for an old file. Unlike OS this information is totally unrelated to the structure of the data and is kept for programmer convenience. If the information is overridden when the file is OPENed the new information about the suggested use of the file will replace the old information.
The JFCB built by FILEDEF is first filled from the DSCB information (only for fields not specified on the FILEDEF command) and then the DCB is filled from the JFCB (only for fields not specified in the DCB). When the file is Closed the information in the DCB is written into the DSCB to be used the next time the file is opened.
When OS programs open multiple DCB's for the same file {DDNAME} the simulator copies the capability key for that data structure and sets up a completely separate control path for the data. For record keepers this works with no restrictions because all of the memory about position within the file is kept in the simulator control blocks associated with each data path. Since terminal protocols are handled specially there is no trouble, but with co-routines the results are a user call of a zero data key. For segments, as with Record keepers, multiple DCB's may result in odd looking files. No provision is made to control the order of entry into the segment. It is up to the user to imagine creative uses for this feature.
Output to record keepers with multiple DCB's will lead to an orderly distribution of records as the records will be interspersed as each data path is used to output data. OS handles this problem by warning the user that the dataset may be ruined by doing this.
Files that are undefined by FILEDEF default to the terminal system {(terminal)}. The DCB parameters are filled in as 80 byte Fixed length records. This allows considerable freedom from OS labors as many programs need not have any files defined by FILEDEF at all.
If there is no information about the format of a file then Fixed length 80 byte records is the default.
Private Communication from Charlie Landau
The second place is in FILEDEF through the FILEDEFQUERY key you {sometimes} supply {type A only}. Whatever you defined appears here. I think FILEDEFQUERY is searched after OSFD.
The support for terminals is a bit kludgy at present. If a file is a terminal, either through filedef or default, it is the one and only terminal, found in slots 3,4,5. Suggestions will be entertained by Alan or me.
A PL/I callable interface to terminal I/O which is much more efficient than the standard OS interface has been provided. The subroutines save 4 gate jumps per terminal transaction. Someday there will be a section in the manual about $TIN and $TOUT. See Bill Frantz about this. It was done for the Adventure and Midas applications.
If a DDNAME is not not declared as a terminal to FILEDEF then the BSAM access method will use co-routine keys {such as to terminals} without incuring the OS domain overhead.
The addresses are determined by the OS simulator scanning tables of components which are included within the simulator itself, the PL/I library, and the application program.
If it is desired to execute an OS program which uses dynamic loading SVC's under OS, it is necessary to define a CSECT with the entry point name GNODLOAD and entries in the following format:
Normally, the module origin (&module) and the entry point (&entry) will be the same external symbol name. &name is the name which the module will be referred to in the dynamic linkage SVC. It is also often the same name as the module name.
The modules described in GNODLOAD must be linkedited with the application program and GNODLOAD under CMS. When the Gnosis initialization program {GNOIBM} is invoked as the application program begins execution, it will complete the linkage between the OS simulator and the list of supplied "dynamic loading" components.
Currently, the simulator gives a maximum of 1 megabyte of memory per Getmain request if variable size specified. For fixed size getmains, the requested size will be allocated if possible.
The memory allocation routines attempt to reuse storage and keep memory allocated densely. Memory is allocated from lowest to highest address.
The interval timing facilities are less complete. Elapsed time measurement and delay facilities are not implemented. CPU time measurement facilities are implemented, however, if the time interval specified is exceeded, the exit routine will not be called. {The code is written, but not debugged.}
Attention Handling
VSAM