*DECK QTOPEN
USETEXT AIPDEF
USETEXT QTRMBUF
USETEXT QTRMCOM
USETEXT QTRMNIT
PROC QTOPEN(NITADDRESS);
*IF,DEF,IMS
#
*1DC QTOPEN
*
* 1. PROC NAME AUTHOR DATE
* QTOPEN E. GEE 86/04/02
*
* 2. FUNCTIONAL DESCRIPTION.
* PROVIDES INITIALIZATION PROCESSING FOR QTRM.
* MAIN PURPOSE IS TO CONNECT (I.E. NETON) TO NETWORK.
*
* 3. METHOD USER.
* INIT RETURN CODE FIELD IN NIT TO QTOPEN FAILED RC.
* IF APPLICATION ALREADY NETTED ON,
* IF APPLICATION DOES NOT WANT TO BE ABORTED,
* STORE REASON CODE IN SEC-RETURN CODE FIELD IN NIT.
* ELSE (OKAY TO ABORT APP),
* CALL NP$ERR TO ISSUE DAYFILE MSG AND ABORT APP.
* ELSE (FIRST TIME CALL TO QTOPEN),
* IF MAX NUMBER OF CONNECTIONS IS ZERO,
* IF APPLICATION DOES NOT WANT TO BE ABORTED,
* STORE REASON CODE IN SEC-RETURN CODE FIELD IN NIT.
* ELSE (OKAY TO ABORT APP),
* CALL NP$ERR TO ISSUE DAYFILE MSG AND ABORT APP.
* ELSE (NONZERO VALUE FOR MAX NUM OF CONNECTIONS),
* LOOP 100 TIMES OR UNTIL NETON STATUS IS NOT NAM NOT AVAIL.
* CALL NETON ROUTINE TO CONNECT TO NAM.
* SET UP FIELD IN NIT TO INTRODUCE DELAY.
* IF NETON STATUS IS NONZERO,
* IF APPLICATION DOES NOT WANT TO BE ABORTED,
* STORE REASON CODE IN SEC-RETURN CODE FIELD IN NIT.
* ELSE (OKAY TO ABORT APP),
* ELSE (NETON REQUEST WAS SUCCESSFUL),
* COMPLETE INITIALIZING NIT.
*
* 4. ENTRY CONDITIONS.
* PARAMETER (NITADDRESS) STARTING ADDRESS OF NETWORK
* INFORMATION TABLE.
*
* 5. EXIT CONDITIONS.
* NIT$RC = 0 IF QTOPEN COMPLETED SUCCESSFULLY.
* REST OF NIT IS ALSO INITIALIZED.
* = NONZERO IF QTOPEN DID NOT COMPLETE
* SUCCESSFULLY. NIT$S$RC
* CONTAINS REASON IT FAILED.
*
* 6. COMDECKS CALLED AND SYMPL TEXTS USED.
* AIPDEF AIP CONSTANTS DEFINITIONS
* NP$CRT CONTROL DATA SYSTEMS COPYRIGHT
* QTRMBUF QTRM BUFFER COMMON BLOCK
* QTRMCOM QTRM COMMON VARIABLES
* QTRMNIT QTRM NETWORK INFORMATION TABLE TEMPLATE
*
* 7. ROUTINES CALLED.
* NP$ERR AIP ERROR DAYFILE ROUTINE.
* NETFUNC AIP CHANGE PROCESSING ROUTINE.
* NETON AIP NETWORK CONNECTION.
* NETPUT AIP TRANMIT DOWNLINE MESSAGE.
*
* 8. DAYFILE MESSAGES.
* NETWORK APPLICATION ABORTED, RC = 80.
* QTOPEN: DUPLICATE QTOPEN.
*
* NETWORK APPLICATION ABORTED, RC = 81.
* QTOPEN: NIT NUM-TERMS FIELD IS ZERO.
*
* NETWORK APPLICATION ABORTED, RC = 82.
* QTOPEN: NETON REJECTED.
*
* NETWORK APPLICATION ABORTED, RC = 83.
* QTOPEN: NETWORK NOT AVAILABLE.
*
*
#
*ENDIF
#
CONTROL DEFINITIONS.
#
CONTROL PRESET;
CONTROL PACK;
CONTROL DISJOINT;
CONTROL INERT;
CONTROL FASTLOOP;
#
XREFS / XDEFS
#
XREF PROC NP$ERR; # AIP ERROR DAYFILE ROUTINE #
XREF PROC NETFUNC; # AIP CHANGE PROCESSING ROUTINE #
XREF PROC NETON; # AIP CONNECT TO NETWORK #
XREF PROC NETPUT;
#
STANDARD DEFS
#
*CALL NP$CRT
#
DUMMY ARRAY USED AS TEMPORARY
#
BASED ARRAY DUMMY[0:0];
BEGIN
ITEM DUMMY$FLAG B(0,0,1);
ITEM DUMMY$ITEM U(0,0,60);
END
#
INPUT PARAMETERS
#
ARRAY NITADDRESS ;; #STARTING ADDRESS OF NIT #
#
QTRMCOM IS COMPILED INLINE TO PRESET COMMON.
#
#
LOCAL VARIABLES
#
ITEM NETONCODE I; # RETURN STATUS FROM NETON #
ITEM LENGTH I; #LENGTH OF TERMINAL ENTRY PORTION OF NIT #
ITEM TEMP I; #FOR LOOP TEMPORARY VARIABLE #
ITEM RETRY I; # FOR LOOP VARIABLE FOR RETRYING NETON. #
ITEM COMMXCN U; # A COMBINATION OF 2 MAX CONNECTION LIMIT:#
# . BIT 48-59: NIT$NO$TERMS #
# . BIT 36-47: NIT$NUMRCNS #
BEGIN
P<NIT> = LOC(NITADDRESS); # SET BASE OF NIT #
NIT$ADDR = P<NIT>; # SAVE NIT ADDRESS IN COMMON #
NIT$RC[0] = S"NETONREJ"; # INIT RC TO QTOPEN REJECT #
IF NETON$STATUS
THEN # DUPLICATE QTOPEN CALL #
BEGIN
IF NOABTNETONA
THEN # DO NOT ABORT APP FOR BAD CALL #
BEGIN
NIT$S$RC[0] = S"DUPQTOPEN"; # REASON FOR QTOPEN REJECT #
END
ELSE # ABORT APP FOR BAD QTOPEN CALL #
BEGIN
NP$ERR("80"); # DUPLICATE QTOPEN. #
END
END
ELSE # FIRST TIME CALL TO QTOPEN #
BEGIN
IF NIT$NO$TERMS EQ 0
THEN # MAX NO OF CONNECTIONS IS ZERO #
BEGIN
IF NOABTNETONA
THEN # DO NOT ABORT APP FOR BAD CALL #
BEGIN
NIT$S$RC[0] = S"ZEROCONS"; # REASON FOR QTOPEN REJECT #
END
ELSE # ABORT APP FOR BAD QTOPEN CALL #
BEGIN
NP$ERR("81"); # MAX NO OF CONNECTIONS IS ZERO #
END
END
ELSE # GOOD VALUE FOR MAX NO OF CONS #
BEGIN
NETONCODE = 1; # INIT TO NAM NOT AVAILABLE #
FOR RETRY = 0 STEP 1 WHILE (NETONCODE EQ 1) AND
(RETRY LQ 100 )
DO
BEGIN
P<DUMMY> = LOC(NIT$NSUP[0]); # LOCATION OF NSUP WORD. #
COMMXCN = NIT$NUMRCNS[0]*4096 + NIT$NO$TERMS[0];
NETON(NIT$APP$NAME[0],DUMMY,NETONCODE,1,COMMXCN);
#
THE FOLLOWING INITIALIZATION STATEMENTS ARE INCLUDED IN
THE FOR LOOP IN ORDER TO INCREASE THE AMOUNT OF TIME
BETWEEN UNSUCESSFUL NETONS.
#
IF (NIT$CHAR$SET[0] LS CT60TRANS) OR
((NIT$CHAR$SET[0] GR CT12ASCII) AND
(NIT$CHAR$SET[0] NQ 10) AND
(NIT$CHAR$SET[0] NQ 11))
THEN # DEFAULT TO DISPLAY CODE #
BEGIN
NIT$CHAR$SET[0] = CT6DISPLAY; # DISPLAY CODE CHAR SET VAL#
ICTX[0] = FALSE; # SET NO TRANSPARENT INPUT FLAG #
ICTD[0] = CT6DISPLAY; # DISPLAY CODE CHAR SET VALUE #
END
ELSE # APP SPECIFIED OTHER CHAR SET #
BEGIN
IF NIT$XPTSET[0] NQ 0
THEN # TRANSPARENT INPUT ALLOWED #
BEGIN
ICTX[0] = TRUE; # SET TRANSPARENT INPUT ALLOWED #
END
ICTD[0] = NIT$PUTSET[0]; # INPUT CHARACTER SET #
END
NIT$S$RC[0] = 0; # ZERO SECONDARY RETURN CODE. #
NIT$NXAP$NUM[0] = 0; # ZERO NEXT APPLICATION FIELD. #
SUPDTW[0] = 1; # INIT DEVICE TYPE SUPPORT FLAG #
# TO SUPPORT ONLY DEVICE TYPE 0 #
IF NIT$SUPPAA EQ 1
THEN # IF APP SUPPORTS A-TO-A CON #
BEGIN
SUPTRAA[0] = TRUE; # SUPPORT INTRAHOST A-A CON FLAG#
SUPTERA[0] = TRUE; # SUPPORT INTERHOST A-A CON FLAG#
END
P<DUMMY> = LOC(NIT$WD0[1]);
LENGTH = NIT$NO$TERMS[0] * 10 - 1;
FOR TEMP = 0 STEP 1 UNTIL LENGTH
DO
BEGIN
DUMMY$ITEM[TEMP] = 0; # ZERO FILL TERMINAL ENTRIES. #
END
END # END OF FOR LOOP. #
IF NETONCODE NQ 0
THEN # NETON HAS FAILED #
BEGIN
NIT$SEC$RC[0] = NETONCODE; # REASON FOR NETON REJECT #
IF NOT NOABTNETONA
THEN # ABORT APP CAUSE NETON FAILED #
BEGIN
IF NETONCODE EQ 1
THEN # NAM WAS NOT AVAILABLE #
BEGIN
NP$ERR("83");
END
ELSE # NAM REJECTED NETON #
BEGIN
NP$ERR("82");
END
END
END
ELSE # NETON COMPLETED SUCCUSSFULLY #
BEGIN
#
NETON OK.
#
NIT$RC[0] = 0; # ASSUME NETON ACCEPTED #
AUTOBREAK = FALSE; # INIT AUTOMATIC BREAK PROC FLG #
BREAKMARK = FALSE; # INIT NOTIFY ON BI/MARK FLAG #
CONINIT = FALSE; # INIT NOTIFY ON CON/REQ FLAG #
CONPOLL = FALSE; # INIT CONNECTION POLLING FLAG #
INACTIVE = FALSE; # INIT NOTIFY ON CON IDLE FLAG #
KDISAS = FALSE; # INIT K-DISPLAY ASSIGNED FLAG #
KDISPLAY = FALSE; # INIT K-DISPLAY SUPPORT FLAG #
REQAA = FALSE; # INIT CON/ACRQ OUTSTANDING FLG #
NETON$STATUS = TRUE; # NETON COMPLETE. #
PMCONV = 0; # INIT CONVERT PM MSG FLAG #
PRUDTW[0] = 0; # INIT PRU/ON PROCESSING FLAG #
USERINTR = FALSE; # INIT NOTIFY ON INTR/USR FLAG #
IGNORE = FALSE; # INIT NOT SEND HOP/ALT FLAG #
NETFUNC(1); # CHANGE AIP NETWAIT PROCESSING #
P<DUMMY> = LOC(NIT$WD0[0]);# ADDR OF NIT HEADER #
DUMMY$ITEM[2] = 0; # CLEAR WORD 3 OF NIT HEADER #
DUMMY$ITEM[3] = 0; # CLEAR WORD 4 OF NIT HEADER #
DUMMY$ITEM[7] = 0; # CLEAR WORD 8 OF NIT HEADER #
DUMMY$ITEM[8] = 0; # CLEAR WORD 9 OF NIT HEADER #
IF SUPTERA[0]
THEN # RESET SUPPORT A-A FLAG IN NIT #
BEGIN
NIT$SUPPAA[0] = 1;
END
NIT$XSLEEP[0] = 0; # INIT EXTENDED SLEEP FIELD TO 0#
#
INITIALIZE ASCII TO DISPLAY CODE CONVERSION TABLE
#
CONVW[ 0] = O"55555555555555555555"; # 00010203040506070809#
CONVW[ 1] = O"55555555555555555555"; # 0A0B0C0D0E0F10111213#
CONVW[ 2] = O"55555555555555555555"; # 1415161718191A1B1C1D#
CONVW[ 3] = O"55555566646053636770"; # 1E1F2021222324252627#
CONVW[ 4] = O"51524556564657503334"; # 28292A2B2C2D2E2F3031#
CONVW[ 5] = O"35363740414243440077"; # 32333435363738393A3B#
CONVW[ 6] = O"72547371740102030405"; # 3C3D3E3F404142434445#
CONVW[ 7] = O"06071011121314151617"; # 464748494A4B4C4D4E4F#
CONVW[ 8] = O"20212223242526273031"; # 50515253545556575859#
CONVW[ 9] = O"32617562766574010203"; # 5A5B5C5D5E5F60616263#
CONVW[10] = O"04050607101112131415"; # 6465666768696A6B6C6D#
CONVW[11] = O"16172021222324252627"; # 6E6F7071727374757677#
CONVW[12] = O"30313261756276555555"; # 78797A7B7C7D7E7F #
P<DUMMY> = O"67"; # WRD CONTAINING 63 CHAR SET FLG#
IF NOT DUMMY$FLAG[0]
THEN # 63 CHARACTER SET MACHINE #
BEGIN
CONVW[ 3] = O"55555566646053556770";
CONVW[ 5] = O"35363740414243446377";
END
END
END
END
RETURN; # QTOPEN COMPLETE. #
END
TERM