NJEOPEN
Purpose
The NJEOPEN macro opens a file for input or output (SYSIN or SYSOUT).
Parameters
- label
- is an optional assembler label.
- filecb
- is the address of the NJE file control block for the NJE file to be opened. This value may be specified as an RX-type address or as register (2) - (12).
- ,TYPE=
- specifies the type of file (SYSIN or SYSOUT) created by the gateway program when the
filecb is
MODE=OUTPUTon the NJEFILE macro. If not specified, the value already in the NJESTYPE field of the filecb is used. This field may be set by:- Specifying the TYPE parameter on the filecb (if not reset)
- The TYPE value specified on a previously-processed NJEOPEN macro
- An NJESTYPE value set by the gateway program
- ,WORK=address
- specifies the address of the NJE work area that was originally passed to the gateway program as word 1 of the R1 parameter list. It may be specified as register (2) - (12). It may also be specified as a fullword where the work area address has been stored. If not specified, the address specified on the WORK parameter for the previous NJE macro is used.
Usage Notes
- After a file is opened for input (transmission), the NJESYIN or NJESYOUT flag in the NJE file control block specifies the type of file that has been opened. For output files, however, the gateway program must set the appropriate bit in the NJE file control block to specify the type of file to be opened. The gateway program should issue the NJEOPEN macro to begin every file to be transmitted or received. It should issue the NJECLOSE macro to end files (unless they are stopped or rejected, whereas the NJEABORT or NJERJECT macro should be used).
- Commands and messages are treated as records in an NMR stream. NMR streams are treated like files that are open all the time. After it initializes, your gateway program should issue NJEOPEN to open an NJE file control block to receive NMRs and an NJE file control block to send NMRs. It does not need to issue NJECLOSE to close the streams.
Return Codes
| Return Code | Meaning |
|---|---|
| 0 | The file was opened successfully. |
| 4 | No input files are available to be opened. This can occur when there are no files in the queue. It can also occur when the transmission algorithm or a query of the GATEWAY-type link show that no queued files are eligible for transmission. The gateway program should perform other work or wait on the file-arrival ECB. |
| 8 | Too many open files. For input and output NMR streams, the maximum number of
files is one. Your gateway program should ensure that this return code is not issued for NMR
streams. Up to 32 streams can be used for input streams, depending on the value of the STREAMS parameter. If the gateway program receives this return code when trying to open an input file, the number of currently active streams specifies the stream limit. The gateway program should not try to open files beyond its stream limit again. There is no limit on the number of output files that can be open; this return code should not be issued now. |
| 12 | Internal error occurred; the file was not opened. The NJERJCOD field in the file control block contains the reason code. |
