*DECK NVFOPAC
USETEXT TEXTNVF
USETEXT TEXTSS
USETEXT TXCMDNV
USETEXT TXSMNVF
USETEXT TXTAPSS
PROC NVFOPAC;
# TITLE NVFOPAC - PERFORM APPLICATION COMMAND. #
BEGIN # NVFOPAC #
#
** NVFOPAC - PERFORM APPLICATION COMMAND.
*
* A. LIM. 82/03/24.
* C. BRION 83/04/26. 83/12/22.
*
* THIS PROCEDURE-S MAIN FUNCTION IS TO PERFORM APPLICATION COMMANDS.
* IT PUTS THE ORGINAL COMMAND INTO UNSOLICITED-STATUS-QUEUE *USQ*.
* IN THE EVENT OF AN ILLEGAL COMMAND, IT SENDS A TERMINAL-TEXT TO
* CONNECTION-TRAFFIC-QUEUE *CTQ*. IT IS CALLED INTO EXECUTION BY:
* *NVFODHC*
*
* PROC NVFOPAC
*
* ENTRY APPLICATION TYPE OF HOP COMMAND IN *WCBUF[1]*,
* *HDRCMD[1]* AND *PARMS*. *WCBUF* IS DEFINED IN
* TEXTSS, AND *HDRCMD* AND *PARMS* DEFINED IN TXCMDNV.
*
* EXIT THE COMMAND IS SENT TO *USQ* AND/OR
* A SH/ISD IS SENT TO *OTQ*, OR
* A TERMINAL-TEXT IS SENT TO *CTQ*.
*
* METHOD IF APPLICATION FOUND IN *AST*, SEND THE COMMAND TO *USQ*,
* AND IF COMMAND IS ENABLING APPLICATION SET STATE IN *AST*
* TO ENABLED. IF IDLE/DISABLE APPLICATION, SEND SH/ISD TO
* *OTQ*. IF ILLEGAL APPLICATION, SEND A MESSAGE TO *CTQ*.
#
#
**** PROC NVFOPAC XREF LIST
#
XREF
BEGIN
PROC NVFOFAD; # FORMAT APPICATION DATA #
PROC NVFOPSS; # PREPARE STATUS SEARCH #
PROC NVFUMQE; # MAKE A QUEUE ENTRY #
PROC SSTAQE; # SS- ACCEPT A QUEUE ENTRY #
PROC SSTETS; # SS- ENLARGE TABLE SPACE #
PROC SSTRTS; # SS- REMOVE TABLE SPACE #
END
#
****
#
DEF APLWRD1 # HDR$TXWCNT[1]+2 #; # INDEX TO APPLICATION NAME #
DEF APLWRD2 # HDR$TXWCNT[1]+3 #; # INDEX TO APPLICATION NAME #
ITEM AN U; # APPLICATION NUMBER #
ITEM ANAME C(10); # APPLICATION NAME #
ITEM I U; # LOOP VARIABLE #
ITEM AORD U; # AST ORDINAL #
ITEM ITEMP I; # INTEGER TEMPORARY #
ITEM MATCH B; # LOOP EXIT VARIABLE #
ITEM NENTRY U; # NO OF ENTRIES IN AST #
ITEM SECNUM U; # NUMBER SECONDARY APPLICATIONS #
ITEM XJ U; # LOOP VARIABLE #
#
* ILAMSG - INVALID APPLICATION MESSAGE BUFFER.
#
ARRAY ILAMSG[00:00] S(3);
BEGIN
ITEM ILA$MSG C(00,00,20) = ["INVALID APPLICATION."];
ITEM ILA$ZERO U(02,00,60) = [0]; # ZERO BYTE TERMINATOR #
END
CONTROL EJECT;
IF HDR$VERB[1] EQ DIA$
OR HDR$VERB[1] EQ ENA$
OR HDR$VERB[1] EQ IDA$
THEN
BEGIN # COMMAND VERB = DIA/ENA/IDA #
MATCH = FALSE;
FOR I = HDR$TXWCNT[1] STEP 1 WHILE (NOT MATCH) AND
((I - HDR$TXWCNT[1]) LS HDR$SPCNT[1])
DO
BEGIN # SEARCH PARM LIST FOR APPL NAME #
IF PAR$PCODE[I] EQ APP$
THEN
BEGIN
ANAME = PAR$ELNAME[I]; # SAVE APPL NAME #
MATCH = TRUE;
END
END
#
* SEARCH *AST* FOR ENTRY THAT MATCHES THE APPL NAME AND SAVE
* THE APPLICATION NUMBER.
#
MATCH = FALSE;
NENTRY = ASTLNGTH/ASTSIZ$; # CALCULATE NUMBER OF ENTRIES #
FOR I = 0 STEP 1 WHILE (NOT MATCH) AND (I LS NENTRY)
DO
BEGIN
IF AST$ANAM[I] EQ ANAME
THEN
BEGIN
AN = AST$AN[I]; # SAVE APPL NUMBER #
MATCH = TRUE;
END
END
WCB$WC[1] = 0; # CLEAR WC WORD #
ABHWORD[1] = 0; # CLEAR ABH WORD #
SPMSG0[1] = 0; # CLEAR MESSAGE BUFFER #
IF MATCH
THEN
BEGIN
NVFUMQE(P<USQ>,PARMS[0],5,0,HDR$TXWCNT[1]*10);
IF HDR$VERB[1] EQ ENA$
THEN
BEGIN
AST$DIF[I-1] = FALSE; # SET AST STATE TO ENABLED #
#
* CHECK IF AST ENTRY IS A PRIMARY ENTRY WITH SECONDARY ENTRIES
* ACTIVE. IF SO, RESET THE DISABLE FLAG OF EACH SECONDARY AST ENTRY
* AS WELL AS THE PRIMARY.
#
IF ((AST$UPANAM[I-1] EQ AST$USANAM[I-1]) AND
(AST$MXCOP[I-1] GR 1))
THEN
BEGIN
FOR AORD = 0 STEP 1 WHILE AORD LS NENTRY
DO
BEGIN
IF AST$SANAM[AORD] EQ AST$PANAM[I-1]
THEN
AST$DIF[AORD] = FALSE;
END
END
END
ELSE
BEGIN
#
* COMMAND IS A DISABLE OR IDLE APPLICATION. SET UP THE SHUT/INSD
* SUPERVISORY COMMAND. IF DISABLE, THEN SET THE DISABLE FLAG OF THE
* AST ENTRY AND THE IMMEDIATE SHUT FLAG OF THE SM. IF A PRIMARY AP-
* PLICATION ONLY, SEND THE SHUT. IF SECONDARY COPIES EXIST AND ARE
* ACTIVE, FIND THEM IN THE AST AND SEND THEM THE SHUT/INSD SM.
#
PFCSFC[1] = SHISD;
SHISAN[1] = AN;
SHISF[1] = FALSE;
SHANAME[1] = ANAME;
WCB$WC[1] = LSH + 2;
ABHABT[1] = APPCMD;
ABHACT[1] = CT60TRANS;
ABHTLC[1] = LSH ;
IF HDR$VERB[1] EQ DIA$
THEN
BEGIN
SHISF[1] = TRUE;
AST$DIF[I-1] = TRUE;
END
IF AN NQ 0
THEN
SSTAQE(P<OTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
ELSE
BEGIN
IF AST$USANAM[I-1] EQ AST$UPANAM[I-1] AND
AST$MXCOP[I-1] GR 1
THEN
BEGIN
FOR AORD = 0 STEP 1 WHILE AORD LS NENTRY
DO
BEGIN
IF ((AST$SANAM[AORD] EQ AST$PANAM[I-1]) AND
(AST$PANAM[AORD] NQ AST$SANAM[AORD]) AND
(AST$JSN[AORD] NQ " "))
THEN
BEGIN
SHANAME[1] = AST$PANAM[AORD];
SHISAN[1] = AST$AN[AORD];
SSTAQE(P<OTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
IF HDR$VERB[1] EQ DIA$
THEN
AST$DIF[AORD] = TRUE;
END
END # FOR LOOP #
END
ELSE # APPLICATION NOT NETTED ON #
IF HDR$VERB[1] EQ DIA$
THEN
AST$DIF[I-1] = TRUE;
END
END
WCB$WORD[1] = 0; # CLEAR WC WORD AGAIN #
ABHWORD[1] = 0; # CLEAR ABH WORD AGAIN #
WCB$IAF[1] = TRUE; # SET INPUT-ALLOW FLAG TRUE #
WCB$HAF[1] = FALSE; # SET HOP-ALERT FLAG FALSE #
WCB$WC[1] = 2;
ABHABT[1] = HOPTX$;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],MSGBUF[0]); # SEND NULL TXT#
END
ELSE
BEGIN # ILLEGAL APPLICATION #
WCB$IAF[1] = TRUE;
WCB$HAF[1] = FALSE;
WCB$WC[1] = LMSG30$/10 + 2;
ABHABT[1] = HOPTX$;
ABHADR[1] = HDR$OPORD[1];
ABHTLC[1] = LMSG30$;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],ILAMSG[0]);
END
END # COMMAND VERB = DIA/ENA/IDA #
#
* IF THE CURRENT COMMAND IS A STATUS OF APPLICATION, OF ALL TERMS
* CONNECTED TO AN APPLICATION OR ALL USERS CONNECTED TO AN APPL,
* THEN SEARCH THE AST FOR THIS APPLICATION. IF FOUND, SEND THE APPL
* DATA TO GET FORMATTED AND, IF THE CURRENT COMMAND IS NOT JUST A
* STATUS OF AN APPL, SEND THE COMMAND TO THE SERIAL SEARCH REQUEST
* PROC TO SEARCH THE VCB-S FOR ALL THE TERMS/USERS CONNECTED TO THIS
* APPLICATION.
#
ELSE IF HDR$VERB[1] EQ STA$ OR
HDR$VERB[1] EQ SSA$ OR
HDR$VERB[1] EQ SUA$
THEN
BEGIN
IF HDR$VERB[1] EQ STA$
THEN
BEGIN
ANAME = PAR$ELNAME[APLWRD1];
END
ELSE
BEGIN
ANAME = PAR$ELNAME[APLWRD2];
END
#
* CHECK IF APPL NAME NOT NVF.
#
IF ANAME NQ "NVF"
THEN
BEGIN
#
* APPL NAME NOT NVF. LOCATE AST ENTRY FOR APPL NAME.
#
FOR I=0 STEP 1 WHILE ANAME NQ AST$ANAM[I] AND
I LS ASTLNGTH/ASTSIZ$
DO
BEGIN
END
IF I LS ASTLNGTH/ASTSIZ$
THEN
BEGIN
#
* AST ENTRY FOUND. SEND PRIMARY APPLICATION STATUS LINE.
* THEN CHECK IF NOT APPLICATION STATUS IN WHICH CASE A SERIAL
* SEARCH OF THE VCBS IS REQUIRED.
* OTHERWISE, FURTHER CHECK OF APPLICATION TYPE AND COPIES IS
* NEEDED.
#
NVFOFAD(I);
IF HDR$VERB[1] NQ STA$
THEN
BEGIN
#
* CALL NVFOPSS FOR SERIAL SEARCH OF VCBS.
#
NVFOPSS;
END
ELSE
BEGIN
#
* STATUS OF APPLICATION.
* SET UP WORD COUNT WORD AND ABH WORD FOR "READY.." MSG.
#
WCB$WORD[1] = 0;
WCB$IAF[1] = TRUE;
WCB$WC[1] = 2;
ABHWORD[1] = 0;
ABHABT[1] = HOPTX$;
#
* DETERMINE IF MULTIPLE COPY TYPE APPLICATION.
* IF SO, FINISHED, SEND "READY.."
#
IF AST$MXCOP[I] EQ 1
THEN
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
ELSE
BEGIN
#
* MULTIPLE COPY TYPE APPLICATION.
* CHECK IF MORE THAN 1 COPY ACTIVE.
* IF NOT, FINISHED, SEND "READY.." STATUS LINE.
#
IF AST$CUCOP[I] EQ 0
THEN
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
ELSE
BEGIN
#
* MULTIPLE COPY TYPE APPLICATION HAS AT LEAST ONE COPY ACTIVE.
* SET UP TO FIND THE SECONDARY APPLICATIONS AND SEND A STATUS LINE
* FOR EACH BEING AWARE THAT THE LAST LINE MUST HAVE THE INPUT
* ALLOWED FLAG SET TRUE IN ORDER TO FINISH THE COMMAND.
#
SECNUM = 0;
NENTRY = ASTLNGTH / ASTSIZ$;
FOR XJ = 0 STEP 1 WHILE
(SECNUM LS AST$CUCOP[I]) AND
(XJ LS NENTRY)
DO
BEGIN
IF ((AST$PANAM[I] EQ AST$SANAM[XJ]) AND
(AST$JSN[XJ] NQ " ") AND
(AST$PANAM[XJ] NQ AST$SANAM[XJ]))
THEN
BEGIN
NVFOFAD(XJ);
SECNUM = SECNUM + 1;
IF SECNUM EQ AST$CUCOP[I]
THEN
BEGIN
#
* LAST STATUS LINE SENT. SEND "READY.. " STATUS LINE.
#
WCB$WORD[1] = 0;
ABHWORD[1] = 0;
WCB$WC[1] = 2;
ABHABT[1] = HOPTX$;
WCB$IAF[1] = TRUE;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
END
END
END
#
* IF THE NUMBER OF SECONDARY APPLICATIONS IS MORE THAN THE NUMBER
* OF MESSAGES SENT, THE "READY.." MESSAGE WAS NOT SENT OUT. SEND
* THE "READY.." STATUS LINE.
#
IF SECNUM LS AST$CUCOP[I]
THEN
BEGIN
WCB$WORD[1] = 0;
ABHWORD[1] = 0;
WCB$WC[1] = 2;
ABHABT[1] = HOPTX$;
WCB$IAF[1] = TRUE;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
END
END
END
END
END
ELSE
BEGIN
WCB$WORD[1] = 0;
WCB$IAF[1] = TRUE;
WCB$WC[1] = 2 + LMSG30$/10;
ABHWORD[1] = 0;
ABHABT[1] = HOPTX$;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],ILAMSG);
END
END
#
* IF THIS APPLICATION IS NVF, SET UP AN AST ENTRY FOR NVF TO
* TO PASS TO THE STATUS FORMATTING ROUTINE. IF THE CURRENT
* COMMAND IS STATUS, OF ALL USERS OR TERMINALS CONNECTED TO NVF,
* CALL THE PREPARE SERIAL SEARCH PROC, OTHERWISE SEND A NULL
* TEXT TO THE HOP WITH THE INPUT ALLOWED FLAG SET.
#
ELSE
BEGIN
SSTETS(P<AST>,0,ASTSIZ$);
AST$ANAM[0] = "NVF";
AST$JSN[0] = "NVF";
AST$DIF[0] = FALSE;
AST$DNF[0] = FALSE;
AST$TACN[0] = PTALNGTH/PTACSIZ$;
AST$AACN[0] = 0;
NVFOFAD(0);
SSTRTS(P<AST>,0,ASTSIZ$);
IF HDR$VERB[1] NQ STA$
THEN
BEGIN
NVFOPSS;
END
ELSE
BEGIN
WCB$WORD[1] = 0;
WCB$IAF[1] = TRUE;
WCB$WC[1] = 2;
ABHWORD[1] = 0;
ABHABT[1] = HOPTX$;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
END
END
END
#
* IF THE CURRENT COMMAND IS STATUS ALL APPLICATIONS, FOR EACH ENTRY
* IN THE AST, FORMAT THE STATUS AND SEND IT OFF TO THE HOP.
#
ELSE IF HDR$VERB[1] EQ STS$
THEN
BEGIN
IF PAR$PCODE[HDR$TXWCNT[1]+3] NQ AC$
THEN
BEGIN
FOR I=0 STEP 1 UNTIL ASTLNGTH/ASTSIZ$-1
DO
BEGIN
NVFOFAD(I);
END
END
#
* IF THE CURRENT COMMAND IS STATUS ALL ACTIVE APPLICATIONS, FOR EACH
* ENTRY IN THE AST WHERE THE APPLICATION IS ACTIVE, FOR THE STATUS
* MESSAGE AND SEND IT OFF TO THE HOP.
#
ELSE
BEGIN
FOR I=0 STEP 1 UNTIL ASTLNGTH/ASTSIZ$-1
DO
BEGIN
IF (NOT AST$DIF[I] AND
NOT AST$DNF[I] AND
AST$JSN[I] NQ " ") OR
(NOT AST$DIF[I] AND
NOT AST$DNF[I] AND
AST$JSN[I] EQ " " AND
AST$CUCOP[I] NQ 0 AND
AST$MXCOP[I] GR 1)
THEN
BEGIN
NVFOFAD(I);
END
END
END
#
* FINALLY SEND A NULL TEXT TO THE C-LAYER TO CLEAN THE PIPE LINE.
#
WCB$WORD[1] = 0;
WCB$IAF[1] = TRUE;
WCB$WC[1] = 2;
ABHWORD[1] = 0;
ABHABT[1] = HOPTX$;
SSTAQE(P<CTQ>,WCBUF[1],ABHBUF[1],NVFSM[1]);
END
END # NVFOPAC #
TERM