*DECK NETXFR
*IF DEF,XFR
USETEXT AIPDEF
USETEXT NP$NWL
USETEXT NP$GETS
USETEXT NP$STAT
USETEXT NP$DB
USETEXT NP$TAA
USETEXT NX$ACBF
USETEXT NX$ACBX
USETEXT NX$MSG
PROC NETXFR(ACN,FILENAME,CODE,STATIS,NOWAIT,DATADEC,TIMEOUT,ABL,FACIL,
BSIZE,CWS,ICKVAL);
# TITLE NETXFR - INITIATE TRANSFER OF A FILE. #
BEGIN # NETXFR #
#
** NETXFR - INITIATE TRANSFER OF A FILE.
*
* NETXFR INITIATES DATA-TRANSFERS TO A REMOTE APPLICATION AND
* UNLESS IMMEDIATE RETURN IS REQUESTED, CALLS NETXFRC UNTIL THE
* TRANSFER IS COMPLETE.
*
* PROC NETXFR(ACN,FILENAME,CODE,STATIS,NOWAIT,DATADEC,TIMEOUT,
* ABL,FACIL,BSIZE,CWS,ICKVAL
*
* ENTRY ACN - APPLICATION CONNECTION NUMBER.
* FILENAME - FILE NAME TO BE TRANSFERRED, IN DISPLAY
* CODE, 7 CHARACTERS MAXIMUM.
* CODE = 0, FILE TO BE RECEIVED FROM THE NETWORK
* = 1, FILE TO BE SENT TO THE NETWORK.
* STATIS - CALLING PROGRAM REPLY STATUS WORD
* NOWAIT = 0, RETURN FROM NETXFR CALL WHEN THE FILE
* TRANSFER IS COMPLETED.
* = 1, RETURN FROM NETXFR CALL IMMEDIATELY.
* DATADEC - FORMAT OF THE DATA THAT IS TO BE
* TRANSFERRED.
* = 0, UH - THE FILE CONTAINS BINARY DATA
* WITH EMBEDDED CONTROL WORDS.
* 1, UU - THE FILE CONTAINS BINARY DATA IN
* AN UNSTRUCTURED (NO EOR/EOFS)
* FORMAT.
* 2, US - THE FILE CONTAINS BINARY DATA IN
* A STRUCTURED FORMAT.
* 3, C6 - THE FILE CONTAINS 6-BIT DISPLAY
* CODE DATA WITH Z-BYTE RECORDS AND
* PHYSICAL BOUNDARIES (EOR/EOFS).
* 4, C8 - THE FILE CONTAINS 8-BIT ASCII IN
* 12-BIT BYTES, 5 CHARACTERS TO A
* WORD. LINES ARE TERMINATED BY
* Z-BYTES. PHYSICAL BOUNDAARIES MAY
* EXIST.
* NOTE: CODED FILES (C6 AND C8) ARE CON-
* VERTED TO A FILE STRUCTURE KNOWN
* INTERNALLY BY FIP AS CN. CN
* FILES ARE 8-BIT ASCII IN 12-BIT
* BYTES USING UNIT SEPARATOR
* CHARACTERS FOR END OF LINES. THE
* CN FORMAT IS HOW ALL CODED FILES
* ARE TRANSMITTED/RECEIVED BY FIP
* TO/FROM THE NETWORK DRIVER (NDR).
* CN MUST NOT BE SPECIFIED BY AN
* APPLICATION.
* TIMEOUT - TIME IN SECONDS TO WAIT FOR A FUNCTION
* RESPONSE BEFORE TIMING OUT.
* ABL - APPLICATION BLOCK LIMIT.
*
* FACIL - OPTIONS AVAILABLE DURING DATA TRANSFER.
*
* CWS - CHECKMARKING WINDOW SIZE
*
* ICKVAL - INITIAL CHECK MARK WINDOW.
*
* EXIT STATIS -2 = TERMINATING.
* -1 = INITIATING.
* 00 = IN PROCESS.
* 01 = COMPLETE, NO ERROR.
* 02 = UNDEFINED ERROR.
* 03 = CONNECTION BROKEN DETECTED. (APPLICATION
* IS EXPECTED TO SEND CON/END/R RESPONSE.)
* 04 = PROTOCOL ERROR.
* 05 = TIMED OUT WAITING FOR RESPONSE FROM
* NETWORK.
* 06 = OUTPUT BLOCK NOT DELIVERED AFTER THREE
* RETRIES.
* 07 = TOO MANY FILE TRANSFERS HAVE BEEN INITIATED.
* 08 = ACN NOT WITHIN ALLOWABLE RANGE.
* 09 = SECOND FILE TRANSFER ATTEMPTED ON ACN.
* 10 = CIO ERROR DETECTED.
* 11 = PREMATURE TERMINATION RECEIVED FROM
* REMOTE APPLICATION.
* 12 = CONTROL WORD FORMAT ERROR.
* 13 = INVALID DEVICE TYPE.
* 14 = EMPTY FILE.
* 15 = BLOCK SEQUENCE NUMBERS ARE NON-CONSECUTIVE
* AND NOT RECOVERABLE IN N RETRIES (DEFAULT 3)
* 16 = BLOCK LEADER NOT RECOGNIZABLE OR PRU
* BOUNDARY VIOLATION AND NOT RECOVERABLE IN
* N RETRIES ( DEFAULT 3 ).
* 17 = BINARY FILE TRANSFER ON PRU CONNECTION.
*
*
* PROCESS
* VALIDATE DATA DECLARATION.
* VALIDATE CODE.
* VALIDATE CONNECTION NUMBER.
* IF NUMFILEXFR LQ 4
* THEN
* SWITCH CONNECTION TO LIST NUMBER 1.
* INITIALIZE THE FTT AND OPEN FILE.
* IF NOT WAIT
* THEN (* COMPLETE THEN RETURN *)
* LOOP UNTIL STATUS IS COMPLETE OR ERROR OCURRED
* IF STATE[FTTINDEX] IS STATEX (* CIO NOTOCOMP *)
* AND STORD[FTTINDEX] IS NOT FOR PRU
* THEN
* RECALL (NP$RCL).
* REVALIDATE THE FILE.
* ELSE
* IF S BIT IS ON
* GET THIS SM.
* ELSE
* CALL NETWAIT FOR CONTINUING FILE TRANSFER.
* END OF LOOP
*
* ELSE (* RETURN TO APPLICATION *)
* RETURN.
*
*
* RETURN.
*
* NOTE - AN OVERLAY WHICH REFERENECES THIS MODULE MUST REMAIN
* IN CM UNTIL ALL FILE TRANSFERS ARE COMPLETE.
*
#
XREF
BEGIN
PROC NP$STPR ; # STATE TABLE PROCESSOR #
PROC NP$GET; # GET SUPERVISORY MESSAGE #
PROC NP$GJO ; # GET ORIGIN OF JOB #
*IF DEF,STAT,1
PROC NP$SN ; # STATISTIC PROCESSOR #
PROC NP$PUT; # NETPUT SWH/LST/R MESSAGE #
PROC NETWTQ; # TRANSFER FILE THR. QUICK NETWAIT#
PROC NP$ERR ;
PROC NP$MSG; # SEND MESSAGE TO DAYFILE #
PROC NP$RCL ; # TO DO RECALL #
PROC NP$RTIM ;
PROC NP$S63 ;
PROC NP$VALF ;
PROC NP$XFR ;
PROC NP$INIT;
FUNC NP$CS63 B;
FUNC NP$CDD C(10) ; # CONVERT INTEGER TO DISPLAY CODE #
END
LABEL RETURNX ;
LABEL SENDMSG ;
ITEM ACN I; # APPLICATION CONNECTION NUMBER #
ITEM FILENAME C(7); # FILE NAME #
ITEM CODE I; # OPERATION CODE #
ITEM STATIS I; # CALLER-S STATUS WORD #
ITEM NOWAIT B; # RETURN ASAP FLAG #
ITEM DATADEC I; # DATA DECLARATION #
ITEM TIMEOUT I; # TIME TO WAIT FOR RESPONSE #
ITEM ABL I; # APPLICATION BLOCK LIMIT #
ITEM FACIL C(10) ;
ITEM BSIZE U; # BLOCK SIZE FOR TRANSMITTING #
ITEM CWS U; # CHECK MARK WINDOW SIZE #
ITEM ICKVAL U; # INITIAL CHECKMARK VALUE #
ITEM I ;
ITEM SCRATCH ;
ITEM LOOPI; # LOOP INDEX #
ITEM FACODE; # FACILITY CODE #
ITEM INDEX I ; # LOCAL INDEX OF THE FTT ENTRY #
CONTROL EJECT;
*IF DEF,STAT,1
NP$SN(TYPE"XFR"); # KEEP STATISTIC COUNT #
#
* IF THIS IS THE FIRST TIME APPLICATION CALL NETXFR ( TIME$UP
* IS ZERO ), THEN CHECK FOR THE CHARACTER SET OF APPLICATION.
* FUNCTION NP$CS63 IS BOOLEAN FUNCTION, VALUE IS SET AT ASSEMBLY
* TIME. IF CHARACTER SET 63 IS USED FOR APPLICATION, NP$CS63 IS
* TRUE.
#
IF TIME$UP EQ 0
THEN
BEGIN # FIRST TIME XFR INITIATED #
NP$RTIM(TIME$WORD) ; # TAKE CURRENT TIME #
TIME$UP = TIME$SEC[0] ;
IF NP$CS63
THEN
NP$S63 ; # RESET THE CHARACTER SET FOR TRANSLATION #
END # FIRST TIME XFR INITIATED #
P<STATUSWORD> = LOC (STATIS);
NET$AWL$XFR = 0 ; # CLEAR THE FLAG #
NP$XFR ; # SEND XFR WORKLIST FOR VALIDA#
IF NET$AWL$XFR EQ 0
THEN
BEGIN # APPL. IS NOT VALIDATED TO CALL #
STATUSWD = XFRNOTALLOW ; # NETXFR #
GOTO SENDMSG ;
END
IF IDLEDOWN
THEN
BEGIN # GRADUALLY IDLE-DOWN #
STATUSWD = DISABLE ; # ALLOW NO MORE TRANSFERRING #
GOTO SENDMSG ;
END # RETURN TO APPLICATION #
STATUSWD = INITIAT ; # ASSUMING EVERYTHING IS O.K. #
IF DATADEC LS MINDD OR
DATADEC GR MAXDD
THEN
BEGIN # INVALID DATA DECLARATION #
NP$ERR("46") ; # WRITE DAYFILE MSG, ABORT THE C.P. #
END
IF CODE LS RECEIVE OR
CODE GR SEND
THEN
BEGIN # INVALID CODE #
NP$ERR("47") ; # WRITE DAYFILE MSG, ABORT THE C.P. #
END
NP$GJO(I) ; # GET THE ORIGIN OF JOB #
IF I EQ JOT$TXOT # INTERACTIVE JOB TYPE #
AND FILENAME EQ "INPUT" # FILE NAME IS INPUT #
THEN
BEGIN # JOB TYPE AND FILE NAME CAN NOT #
STATUSWD = ILL$JOT ; # BE TRANSFERRED #
GOTO RETURNX ;
END
IF ACN LS MINIACN
OR ACN GR MAXIACN
THEN
BEGIN # ACN OUT OF RANGE #
STATUSWD = ACN$NWR ; # REYURN STATUS BACK TO APPL. #
GOTO RETURNX;
END
IF ABL LQ 0
OR ABL GR ABLLIMIT
THEN
BEGIN # ABL NOT IN THE RANGE #
STATUSWD = ABL$ERR ;
GOTO RETURNX;
END
P<FACILTEST> = LOC(FACIL); # PULL TEMPLATE TO FACIL WORD #
FACODE = B<0,6>FACILITY; # GET FIRST FACILITY CODE #
FOR LOOPI = 6 STEP 6 WHILE ((FACODE NQ BLANK) AND (FACODE NQ 0))
DO
BEGIN
IF FACODE NQ SFACIL AND # NOT -S- FACILITY #
FACODE NQ RFACIL AND # NOT -R- FACILITY #
FACODE NQ MFACIL # NOT -M- FACILITY #
THEN
BEGIN
STATUSWD = BAD$FAC; # BAD FACILITY CODE USED #
FACILWD[0] = 0; # CLEAR BIT MASK #
GOTO RETURNX; # EXIT #
END
ELSE
BEGIN
B<FACODE,1>FACILWD[0] = 1; # SET FLAG FOR FACILITY CODE #
FACODE = B<LOOPI,6>FACILITY; # EXTRACT NEXT FACILITY CODE #
END
END
IF DATADEC GQ C6
THEN
BEGIN
IF BSIZE LQ 0
OR BSIZE GR IVT$MAX$BSZ
THEN
BEGIN # ERROR IN BLOCK SIZE #
STATUSWD = BSXALOW ; # BLOCKSIZE NOT IN RANGE #
GOTO RETURNX;
END # ERROR IN BLOCK SIZE #
END # IVT MODE #
ELSE
BEGIN # PRU MODE #
IF BSIZE NQ ONE$PRU
AND BSIZE NQ TWO$PRU
AND BSIZE NQ THREE$PRU
THEN
BEGIN # BSIZE IS NOT 1,2 OR 3 PRU #
STATUSWD = BSXALOW ;
GOTO RETURNX;
END
END # PRU MODE #
IF CWS LS 1 OR CWS GR MXCWS # IF CWS OUT OF RANGE #
THEN
BEGIN
STATUSWD = ILL$CWSZ;
GOTO RETURNX;
END
IF ICKVAL LS 0 OR ICKVAL GR MXICKVAL # IF ICKVAL OUT OF RANGE #
THEN
BEGIN
STATUSWD = ILL$ICKZ;
GOTO RETURNX;
END
IF NUMFILEXFR LS MAXFILEXFR
THEN
BEGIN # INITIATE A FILE TRANSFER #
NUMFILEXFR = NUMFILEXFR + 1 ;
LASTXFRACN = ACN ;
#
* INITIATE THE FILE TRANSFER.
#
IDFM$LFN[INITIAT] = FILENAME ;
NP$MSG(IDFM$MSG[INITIAT],XFRDTYPE);
NP$INIT(ACN,FILENAME,CODE,STATUSWORD,DATADEC,TIMEOUT,ABL,
BSIZE,CWS,ICKVAL) ;
INDEX = FTTINDEX ; # LOCAL INDEX FOR THIS FTT ENTRY #
IF STATUSWD NQ INITIAT
THEN
GOTO RETURNX; # ERROR FOUND DURING INITIALIZATION #
#
* SWITCH THIS CONNECTION ONTO LIST 1.
#
LST$ACN[0] = ACN;
LST$NLIST[0] = XFR$LIST ;
OUT$ABHTLC[0] = 1 ;
LOC$HA = LOC(OUT$ABH) ;
LOC$TA = LOC(LST$SWH) ;
OPCODE = OP$PUT ;
*IF DEF,STAT,1
IAM = TYPE"PUT" ;
NP$PUT ; # NETPUT LST/SHW TO SWITCH TO LIST 1 #
#
SWITCHING ICT OF THIS CONN. TO CHARACTER TYPE 2.
#
DC$ACN[0] = ACN ;
DC$ACT[0] = CT8ASCII ;
LOC$HA = LOC(OUT$ABH) ;
LOC$TA = LOC(DC$CICT) ;
NP$PUT ;
#
CALL STATE TABLE PROCESSOR FOR APPROPRIATE INITIAL ACTION
( EFFECTED PRU MODE ONLY )
#
NP$STPR(FTTINDEX,NSPTOCM,0) ;
IF NOT NOWAIT
THEN
BEGIN # COMPLETE THIS FILE TRANSFER AND CONTINUE ALL OTHERS #
FOR I = I WHILE STATIS LQ IN$PROG
DO
BEGIN
FTTINDEX = INDEX ; # RESET THE LOCAL INDEX OF FTT #
IF FTTSTATE[FTTINDEX] EQ STATX
THEN
BEGIN # CIO OUTSTANDING #
NP$RCL(CIOCALL);
NP$VALF ; # RE-VALIDATE THE FILE #
END # CIO OUTSTANDING #
ELSE
BEGIN # OK, PROCEED XFR #
IF (SD$FLAG NQ 0) OR # SUP MSGS QUEUED IN NIP #
(HEAD NQ FOOT) # SUP MSGS QUEUED IN AIP #
THEN
BEGIN # GET SUPERVISORY MESSAGE #
ACLN = 0 ; # ACN = 0 #
LOC$HA = LOC(DATA$WORD[0]);# HEADER LOCATION #
LOC$TA = LOC(DATA$WORD[1]);# TEXT LOCATION #
TLMX = MXIVT$SIZE ; # TEXT LENGTH #
OPCODE = OP$GET ; # OPCODE IS GET #
NWL[NEXT] = 0 ; # CLEAR THE NWL OPCODE #
NWL$TA[NEXT] = LOC$TA ;
BS = OPABHSIZ ;
NP$GET ;
END # GET SUPERVISORY MESSAGE #
IF XFR$COM # IF FILE XFR COMPLETED #
THEN
BEGIN
XFR$COM = FALSE; # RESET FLAG TO FASLE #
END
ELSE
BEGIN
NETWTQ(TIMEOUT,0); # QUICK NETWAIT OTHERWISE #
END
END
END
END
ELSE
BEGIN # RETURN CONTROL TO APPLICATION #
STATUSWD = IN$PROG ;
GOTO RETURNX ;
END # CONTINUE FILE TRANSFER LATER #
END
ELSE
BEGIN
STATUSWD = GTMAXFR ;
RETURNX:
IDFM$LFN[STATUSWD] = FILENAME ;
SENDMSG:
NP$MSG(IDFM$MSG[STATUSWD],XFRDTYPE); # DAYFILE MESSAGE #
END
RETURN;
END # NETXFR #
TERM
*ENDIF