*DECK CSSACO
USETEXT TEXTCS;
USETEXT TEXTSS;
USETEXT TXTSMCS;
USETEXT TXCMDCS;
USETEXT TXTAPSS;
USETEXT TXTSUSS;
PROC CSSACO;
# TITLE CSSACO - ACTION CONTROL COMMAND #
BEGIN # CSSACO #
#
** PROC CSSACO
*
* C. BRION 82/04/30.
* D. K. ENDO 83/02/09 ADD MULTIPLE NOPS.
*
* THIS PROC PROCESSES THE CONTROL COMMAND FOR CS.
*
* PROC CSSACO
*
* ENTRY
* 1. HDRCMD[0] = HEADER WORD FOR FORMATTED COMMAND BLOCK.
* 2. PARMS[0] = COMMAND BLOCK CONTAINING THE ORIGINAL TYPEIN
* AND STRUCTURED FORMATTED PARAMETERS.
*
* EXIT
* 1. CSCNOP = ACN VALUE OF CONTROLLING NOP UPDATED.
* 2. TERMINAL TEXT TO THE CONNECTION TRAFFIC QUEUE FOR THE
* REQUESTING NOP.
* 3. CONTROL OFF/ON ENTRY TO THE EVENT QUEUE.
*
#
#
**** PROC CSSACO XREF LIST
#
XREF
BEGIN
PROC SSBCBW; # SS-CLEAR BIT IN WORD #
PROC SSBSBW; # SS-SET BIT IN WORD #
PROC SSTAQE; # SS-ACCEPT QUEUE ENTRY #
END
#
****
#
#
* PROC CSSACO DEFS
#
DEF MODEIDX # HDR$TXWCNT[0]+3 #;# MODE INDEX INTO PARM LIST #
DEF NORIDX # HDR$TXWCNT[0]+4 #;# NPU ORDINAL INDEX #
DEF NPIDX # HDR$TXWCNT[0]+2 #;# NPU INDEX INTO PARM LIST #
#
* PROC CSSACO ITEMS
#
ITEM I;
ITEM CTRLCNT; # NUMBER OF NPUS CONTROLLED #
ITEM NPUORD; # NPUCB ORDINAL #
ITEM ONFLAG B; # OFF KEYWORD INDICATOR #
ITEM TNAME C(10); # TERMINAL NAME #
#
* FLG$WORD - BASED ARRAY USED TO POINT TO THE REPORT BIT MAP
* IN THE NPUCB-S.
#
BASED ARRAY FLG$WORD [00:00] S(NPCBSZ$);
BEGIN
ITEM FW$WORD I(00,00,60);
END
#
* RESCMD - MESSAGE ARRAY FOR RESTRICTED CMD MESSAGE.
#
ARRAY RESCMD [00:00] S(5);
BEGIN
ITEM RES$TXT0 C(00,00,20) = ["COMMAND RESTRICTED T"];
ITEM RES$TXT1 C(02,00,20) = ["O NETWORK OPERATORS "];
ITEM RES$TXT2 U(04,00,60) = [0];
END
#
* ALLCTRL - ALL NPU-S ARE CONTROLLED MESSAGE ARRAY.
#
ARRAY ALLCTRL [00:00] S(5);
BEGIN
ITEM ACT$TXT1 C(00,00,20) = ["ALL NPUS ARE BEING C"];
ITEM ACT$TXT2 C(02,00,23) = ["ONTROLLED BY OTHER NOPS"];
ITEM ACT$ZBYT U(04,12,48) = [0];
END
#
* AUCTRL - AUTO CONTROL STATUS MESSAGE ARRAY.
#
ARRAY AUCTRL [00:00] S(4);
BEGIN
ITEM AUC$TXT1 C(00,00,20) = ["YOU NOW HAVE AUTO CO"];
ITEM AUC$TXT2 C(02,00,12) = ["NTROL STATUS"];
ITEM AUC$ZBYT U(03,12,48) = [0];
END
#
* CTRLNOP - CONTROLLING NOP MESAGE ARRAY.
#
ARRAY CTRLNOP [00:00] S(3);
BEGIN
ITEM CTR$TNAM C(00,00,07); # TERMINAL NAME #
ITEM CTR$TXT1 C(00,42,03) = [" IS"];
ITEM CTR$TXT2 C(01,00,16) = [" CONTROLLING NOP"];
ITEM CTR$ZERO U(02,36,24) = [0];
END
#
* NOCTRL - NO CONTROLLING NOP MESSAGE.
#
ARRAY NOCTRL [00:00] S(4);
BEGIN
ITEM NCT$MSG1 C(00,00,16) = ["YOU ARE NOT THE "];
ITEM NCT$MSG2 C(01,36,15) = ["CONTROLLING NOP"];
ITEM NCT$ZBYT U(03,06,54) = [ 0 ];
END
#
* NOACTRL - NO AUTO CONTROL PERMITTED MESSAGE ARRAY.
#
ARRAY NOACTRL [00:00] S(3);
BEGIN
ITEM NAC$TNAM C(00,00,07);
ITEM NAC$TXT1 C(00,42,17) = [" HAS AUTO CONTROL"];
ITEM NAC$ZBYT U(02,24,36) = [0];
END
CONTROL EJECT;
PROC FORMSTAT(ORDINAL);
# TITLE FORMSTAT - FORMAT NPU STATUS LINE. #
BEGIN # FORMSTAT #
#
* FORMSTAT - FORMAT NPU STATUS LINE.
*
* D.K. ENDO 83/02/09
*
* THIS IMBEDDED ROUTINE OF CSSACO FORMATS AN NPU STATUS LINE AND
* SENDS IT TO THE OPERATOR VIA THE C-LAYER.
*
* PROC FORMSTAT(ORDINAL)
*
* ENTRY 1. ORDINAL = NPUCB ORDINAL.
* 2. ABHADR[0] = OPERATOR OCB ORDINAL (ACN).
*
* EXIT 1. ENTRY IN THE C-LAYER QUEUE.
#
ITEM ORDINAL; # NPUCB ORDINAL #
#
* NPLINE - MSG ARRAY FOR NPU INFO LINE.
#
ARRAY NPLINE [00:00] S(3);
BEGIN
ITEM NPL$TXT0 C(00,00,04) = ["NPU:"];
ITEM NPL$NPNAME C(00,24,07); # NPU NAME #
ITEM NPL$TXT1 C(01,06,01) = [","];
ITEM NPL$NID C(01,12,03); # NPU NODE ID #
ITEM NPL$TXT2 C(01,30,01) = [","];
ITEM NPL$STATE C(01,36,02); # NPU STATE #
ITEM NPL$TXT3 C(01,48,02) = [", "];
ITEM NPL$NGO C(02,00,06); # NEED GO INDICATOR #
ITEM NPL$ZBYT U(02,36,24) = [0];
END
#
* FORMSTAT CODE BEGINS HERE
#
NPL$NPNAME[0] = NPU$NAME[ORDINAL];
NPL$NID[0] = NPU$DNID[ORDINAL];
IF NPU$GFLAG[ORDINAL]
THEN
BEGIN
NPL$TXT3[0] = ", ";
NPL$NGO[0] = "NEEDGO";
END
ELSE
BEGIN
NPL$TXT3[0] = " ";
NPL$NGO[0] = " ";
END
IF NPU$STAT[ORDINAL] EQ SUPSTAT"SUP"
THEN
NPL$STATE[0] = "AC";
ELSE
NPL$STATE[0] = "MI";
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],NPLINE[0]);
END # FORMSTAT #
#
* PROC CSSACO EXECUTION STARTS HERE
#
#
* IF A HOP ATTEMPTED CONTROL COMMAND, SUPERFLUOUS. INFORM THE HOP
* WITH A MESSAGE.
#
IF HDR$OPORD[0] EQ HOPORD$
THEN
BEGIN
WCB$WORD[1] = 7;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],RESCMD[0]);
GOTO ENDEXIT;
END
#
* COMMAND ATTEMPTED FROM NOP. CHECK FOR ON OR OFF KEYWORD IN THE
* COMMAND PARMS ARRAY. IF NO KEYWORD PRESENT, DEFAULT TO ON.
#
IF PAR$PCODE[MODEIDX] EQ "ON0"
THEN
BEGIN
ONFLAG = TRUE;
END
ELSE
BEGIN
ONFLAG = FALSE;
END
#
* IF A SPECIFIC NPU WAS SPECIFIED, THEN GET THE NPUCB ORDINAL
* FROM THE PARAMETER LIST.
#
IF PAR$PCODE[NPIDX] EQ "NP0"
THEN
BEGIN
NPUORD = PAR$ORD[NORIDX];
#
* IF CONTROL IS REQUESTED, THEN CHECK IF THIS NPU IS ALREADY
* CONTROLLED. IF NOT, THEN STORE THE OPERATOR ACN IN THE NPUCB
* AND SEND THE EVENT TO THE EVENT QUEUE, OTHERWISE SEND AN ERROR
* MESSAGE INDICATING THE NPU IS ALREADY UNDER CONTROL.
#
IF ONFLAG
THEN
BEGIN
IF NPU$CNOP[NPUORD] EQ 0
THEN
BEGIN
NPU$CNOP[NPUORD] = HDR$OPORD[0];
WCB$WORD[1] = 3;
WCB$SMID[1] = SMID"CTRLON";
ABHSN[1] = NPUORD;
TNAME = OC$TNAM[NPU$CNOP[NPUORD]];
SSTAQE(P<EVQ>,WCBUF[1],ABH[1],TNAME);
WCB$WORD[1] = 5;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
FORMSTAT(NPUORD);
P<FLG$WORD> = LOC(NPU$RFLGS[NPUORD]);
SSBSBW( FLG$WORD , HDR$OPORD[0] );
END
ELSE
BEGIN
CTR$TNAM[0] = OC$TNAM[NPU$CNOP[NPUORD]];
WCB$WORD[1] = 5;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],CTRLNOP);
END
END
#
* IF REQUEST IS TO RELEASE CONTROL, THEN CHECK IF THIS NOP
* CONTROLS THE NPU. IF SO, THEN CLEAR THE CONTROLLING NOP IN
* THEN NPUCB AND SEND THE EVENT TO THE EVENT QUEUE, OTHERWISE
* SEND AN ERROR MESSAGE. IF THIS OPERATOR HAS AUTO CONTROL
* STATUS, THEN RELEASE THAT STATUS.
#
ELSE
BEGIN
IF HDR$OPORD[0] EQ NPU$CNOP[NPUORD]
THEN
BEGIN
NPU$CNOP[NPUORD] = 0;
WCB$WORD[1] = 3;
WCB$SMID[1] = SMID"CTRLOFF";
ABHSN[1] = NPUORD;
TNAME = OC$TNAM[HDR$OPORD[0]];
SSTAQE(P<EVQ>,WCBUF[1],ABH[1],TNAME);
IF HDR$OPORD[0] EQ CSACNOP
THEN
BEGIN
CSACNOP = 0;
END
P<FLG$WORD> = LOC(NPU$RFLGS[NPUORD]);
SSBCBW( FLG$WORD , HDR$OPORD[0] );
IF CSACNOP NQ 0
THEN
BEGIN
NPU$CNOP[NPUORD] = CSACNOP;
SSBSBW(FLG$WORD,CSACNOP);
WCB$SMID[1] = SMID"CTRLON";
TNAME = OC$TNAM[CSACNOP];
SSTAQE(P<EVQ>, WCBUF[1], ABH[1], TNAME);
END
END
ELSE
BEGIN
WCB$WORD[1] = 6;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],NOCTRL);
END
END
END
#
* -NPUS- OR -AUTO- WAS SPECIFIED. IF CONTROL IS REQUESTED, THEN
* FOR EACH NPU THAT IS SUPERVISED AND NOT CONTROL, ASSIGN THIS
* OPERATOR TO BE THE CONTROLLING NOP AND SEND EVENT INDICATING
* CONTROL IS ASSIGNED.
#
ELSE
BEGIN
IF ONFLAG
THEN
BEGIN
CTRLCNT = 0;
WCB$WORD[1] = 3;
WCB$SMID[1] = SMID"CTRLON";
FOR I=0 STEP 1 WHILE I LS CSNPCNT
DO
BEGIN
IF NPU$STAT[I] EQ SUPSTAT"SUP" AND
NPU$CNOP[I] EQ 0
THEN
BEGIN
CTRLCNT = CTRLCNT + 1;
NPU$CNOP[I] = HDR$OPORD[0];
ABHSN[1] = I;
TNAME = OC$TNAM[HDR$OPORD[0]];
SSTAQE(P<EVQ>,WCBUF[1],ABH[1],TNAME);
P<FLG$WORD> = LOC(NPU$RFLGS[I]);
SSBSBW( FLG$WORD[0] , HDR$OPORD[0] );
END
END
#
* IF ALL NPU-S ARE BEING CONTROLLED, THEN SEND MESSAGE INDICATING
* SO, OTHERWISE LIST THE NPU-S UNDER THE OPERATOR-S CONTROL.
#
IF CTRLCNT EQ 0
THEN
BEGIN
WCB$WORD[1] = 6;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],ALLCTRL);
END
ELSE
BEGIN
WCB$WORD[1] = 5;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
FOR I = 0 STEP 1 WHILE I LS CSNPCNT
DO
BEGIN
IF NPU$STAT[I] NQ SUPSTAT"SUPLOST" AND
NPU$CNOP[I] EQ HDR$OPORD[0]
THEN
BEGIN
FORMSTAT(I);
END
END
END
#
* IF -AUTO- WAS SPECIFIED, THEN CHECK IF AN OPERATOR ALREADY HAS
* AUTO CONTROL STATUS. IF SO, THEN SEND A MESSAGE INDICATING THAT
* SOMEONE ELSE ALREADY HAS AUTO CONTROL, OTHERWISE SEND A MESSAGE
* INDICATING THAT THE OPERATOR NOW HAS AUTO CONTROL STATUS.
#
IF PAR$PCODE[NPIDX] EQ "AU0"
THEN
BEGIN
WCB$WORD[1] = 0;
WCB$SMID[1] = SMID"TTEXT";
ABHADR[1] = HDR$OPORD[0];
IF CSACNOP EQ 0
THEN
BEGIN
CSACNOP = HDR$OPORD[0];
WCB$WC[1] = 6;
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],AUCTRL);
END
ELSE
BEGIN
WCB$WC[1] = 5;
NAC$TNAM[0] = OC$TNAM[CSACNOP];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],NOACTRL);
END
END
END
#
* -NPUS- OR -AUTO- WAS SPECIFIED AND CONTROL IS TO BE RELEASED.
* IF -NPUS- WAS SPECIFIED, THEN CLEAR ALL THE CONTROLLING NOP
* FIELDS IN THE NPUCB-S THAT MATCH THIS OPERATOR-S ORDINAL.
#
ELSE
BEGIN
IF PAR$PCODE[NPIDX] EQ "NPS"
THEN
BEGIN
WCB$WORD[1] = 3;
FOR I=0 STEP 1 WHILE I LS CSNPCNT
DO
BEGIN
IF NPU$STAT[I] NQ SUPSTAT"SUPLOST" AND
NPU$CNOP[I] EQ HDR$OPORD[0]
THEN
BEGIN
NPU$CNOP[I] = 0;
WCB$SMID[1] = SMID"CTRLOFF";
ABHSN[1] = I;
TNAME = OC$TNAM[HDR$OPORD[0]];
SSTAQE(P<EVQ>,WCBUF[1],ABH[1],TNAME);
P<FLG$WORD> = LOC(NPU$RFLGS[I]);
SSBCBW( FLG$WORD, HDR$OPORD[0] );
IF CSACNOP NQ 0
THEN
BEGIN
NPU$CNOP[I] = CSACNOP;
SSBSBW(FLG$WORD,CSACNOP);
WCB$SMID[1] = SMID"CTRLON";
TNAME = OC$TNAM[CSACNOP];
SSTAQE(P<EVQ>, WCBUF[1], ABH[1], TNAME);
END
END
END
END
#
* FOR -NPUS- OR -AUTO-, IF THIS OPERATOR IS A CONTROLLING NOP, THEN
* CLEAR THE AUTO CONTROL STATUS FOR THIS OPERATOR.
#
IF CSACNOP EQ HDR$OPORD[0]
THEN
BEGIN
CSACNOP = 0;
END
END
END
ENDEXIT:
#
* SEND EMPTY TEXT WITH INPUT ALLOWED FLAG SET TO TERMINATE THE
* COMMAND.
#
WCB$WORD[1] = 2;
WCB$SMID[1] = SMID"TTEXT";
WCB$IAF[1] = TRUE;
ABHWORD[1] = 0;
ABHADR[1] = HDR$OPORD[0];
SSTAQE(P<CNQ>,WCBUF[1],ABH[1],MSGBUF);
END #CSSACO#
TERM