Writing your own node error program
You can write your own node error program (NEP) in any of the CICS®-supported languages. If you code in assembler language, you can use the sample NEP as a framework on which to construct your own node error program.
As described in Multiple NEPs, you can write several node error programs. When an error occurs, the node abnormal condition program passes control to an interface module, DFHZNEPI, which determines the transaction class and passes control to the appropriate node error program.
If only one node error program is used, the interface module (DFHZNEPI) is not required. If the node error program is named DFHZNEP, the node abnormal condition program branches directly to that. If more than one node error program is used, the interface module DFHZNEPI is required. In this case, the node error programs must be given names other than DFHZNEP. There must be an installed program definition for every node error program generated.
CICS-supplied sample NEP
CICS provides NEP code is provided in assembler language, and the communication area parameter list is supplied in assembler language and C® versions. The names of the supplied source files, copybooks, and macros, and the libraries in which they can be found, are listed in Table 1.
Where you see nn, the nn indicates the CICS version and library is the library name. For example, CICSTS63.CICS.SDFHLOAD.
| Name | Type | Description | Library |
|---|---|---|---|
| DFHZNEP0 | Program | Default node error program (assembler language) | CICSTSnn.CICS..SDFHSAMP |
| DFHZNEPX | Source | Default NEP (embedded by DFHZNEP0 via COPY statement) | CICSTSnn.CICS..SDFHSAMP |
| DFHSNEP | Macro | Sample NEP program generator (assembler language) | CICSTSnn.CICS..SDFHMAC |
| DFHZNEPI | Macro | NEP interface generator (for multiple NEPs) | CICSTSnn.CICS..SDFHMAC |
| DFHNEPCA | Macro | assembler language communication area | CICSTSnn.CICS..SDFHMAC |
| DFHNEPCA | Copybook | C-language communication area | CICSTSnn.CICS..SDFHC370 |
Restrictions on the use of EXEC CICS commands
The commands that a node error program (NEP) can issue are restricted. In particular, do not use commands that require a principal facility, because their results are unpredictable.
- Terminal control. For example, issuing an EXEC CICS DELAY command can cause the CSNE task to suspend and never resume, which can cause shutdown of the region to hang. CEMT-type commands, however, such as EXEC CICS INQUIRE TERMINAL, are permitted.
- BMS (except routing).
- ISC communication (including function shipping), including START requests for
remote transactions, although such requests are not recommended because CSNE (Node Abnormal
Condition task) might become suspended while issuing an ALLOCATE command to the remote system.
To start a remote transaction, start a local transaction which in turn starts a remote transaction.
- Updates to recoverable resources. If the resources are locked by another task, the CSNE unit of work can be suspended or shunted.
You cannot use the NEP to suppress DFHZNAC messages.
Coding the entry to provide addressability
EXEC CICS ADDRESS COMMAREA
EXEC CICS ADDRESS EIB- Assembler
-
If you write your node error program in assembler language, you generate the communication area DSECT by coding:
DFHNEPCA TYPE=DSECT - C
-
If you write your program in C, you include the communication area definitions by coding:
#include <dfhnepca>
Coding for session failures
Following some categories of error associated with logical unit or path failures, the session between CICS and the logical unit may be lost. The default action taken by DFHZNAC may be to put the TCTTE out of service.
A method of automatically reacquiring the session is for your node error program to alter the default DFHZNAC actions and to keep the TCTTE in service. Your node error program can then issue an EXEC CICS START TERMID(name) command against that TCTTE for a transaction written in a similar manner to the CICS “good morning” signon message (CSGM). When the transaction is initiated using automatic transaction initiation (ATI), CICS tries to reacquire the session. If the session fails again, DFHZNAC is re-invoked and the process is repeated.
The time specified on the EXEC CICS START command is determined by installation-dependent expected-mean-time-to values.
If used in this way, the initiated transaction can write an appropriate signon message when the session has been acquired. Note, however, that if LOGONMSG=YES is specified on the CEDA DEFINE TYPETERM command, the CICS “good morning” message is also initiated when the session is opened. See Restrictions on the use of EXEC CICS commands.
Coding for specific SNA sense codes
TEST1 EQU *
CLC TWASENSR(2),SNS1 SENSE CODE EQUAL TO NNNN
BNE TEST2 NO, THEN NEXT TEST
NI TWAOPT1,TWAOAF PRINT ACTION MESSAGES ONLY
OI TWAOPT2,TWAOAS+TWAOAR+TWAOAT ABANDON SEND,RECEIVE AND TASK
NI TWAOPT2,255-TWAOASM SET SIMLOGON OFF
OI TWAOPT3,TWAOINT SET INTLOG NOW ALLOWED
NI TWAOPT3,255-TWAONINT OR RESET NOINTLOG
B END
.
.
.
SNS1 DC X'NNNN'