Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-02 - decus/20-0063/dial.doc
There are 2 other files named dial.doc in the archive. Click here to see a list.
	ASYNCHRONOUS COMMUNICATIONS SUBROUTINES

THE ASYNCHRONOUS COMMUNICATIONS PACKAGE CONTAINS FIVE SUBROUTINES
CALLABLE EITHER FROM COBOL PROGRAMS
OR FROM FORTRAN PROGRAMS.  THESE SUBROUTINES ALLOW THE USER TO
INITIALIZE A TTY LINE FOR COMMUNICATIONS WITH ANOTHER COMPUTER,
PLACE A CALL OUT ON THAT LINE TO THE OTHER COMPUTER (IF DIAL OUT
HARDWARE EXISTS FOR THAT LINE), INITIATE THE COUNTERPART COMMUNICATIONS JOB
IN THE OTHER COMPUTER, THEN SEND AND RECEIVE DATA TO AND FROM THE OTHER 
COMPUTER WITH COMPLETE ERROR DETECTION AND ERROR CORRECTION,
AND FINALY DISCONECT THE COMMUNICATIONS LINE
AT THE TERMINATION OF THE DATA TRANSFER.

THE FOLLOWING IS A DESCRIPTION OF THE FIVE SUBROUTINES, THEIR
CALLING SEQUENCE, THEIR ERROR CODES, AND SAMPLE PROGRAMS DEMONSTRATING
THE USE OF EACH OF THE SUBROUTINES.
INIT - THE INITIALIZATION SUBROUTINE

FORTRAN CALL:
	CALL INITF(IOINDX, IERROR, ITYPE)

COBOL CALL:
	ENTER MACRO INITC USING IOINDX, IERROR, ITYPE

WHERE THE ARGUMENTS ARE DEFINED AS:
	IOINDX	   FORTRAN:
			IOINDX MUST BE AN INTEGER VARIABLE CONTAINING
			THE UNIVERSAL I/O INDEX OF THE TTY LINE
			TO BE USED AS THE COMMUNICATIONS LINE.
			THIS INDEX IS OCTAL 200000
			PLUS THE TTY LINE NUMBER.
			THE UNIVERSAL I/O INDEX IS DESCRIBED
			IN THE DECSYSTEM-10 MONITOR CALLS
			MANUAL.
		   COBOL:
			IOINDX MUST BE A COMPUTATIONAL ITEM WITH A
			DECIMAL VALUE EQUIVALENT TO OCTAL 200000
			PLUS THE TTY NUMBER (EG. THE IOINDX FOR
			TTY LINE 14 WOULD BE 65,536 + 12 OR  65,548
			DECIMAL).  IOINDX IS DEFINED AS:
			IOINDX PIC 9(10) COMP VALUE 65548.

	IERROR	   FORTRAN:
			IERROR IS AN INTEGER VARIABLE WHICH IS SET
			EITHER TRUE (-1) OR FALSE (0) DEPENDING 
			ON WHETHER THE INITIALIZATION WAS COMPLETED
			SUCCESSFULLY. 
			IF IERROR IS FALSE, THEN ITYPE CONTAINS
			THE TYPE OF FAILURE THAT OCCURED.
		   COBOL:
			IERROR IS A COMPUTATIONAL ITEM WHICH IS SET
			TO EITHER TRUE (-1) OR FALSE (0) AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  IERROR IS DEFINED AS:
			IERROR PIC 9(10) COMP.

	ITYPE	   FORTRAN:
			ITYPE IS AN INTEGER VARIABLE SET TO THE TYPE
			OF ERROR ENCOUNTERED BY THE SUBROUTINE.
			IF IERROR IS FALSE THEN ITYPE IS
			RETURNED WITH THE FOLLOWING VALUES:
			1 - TTY LINE IS NOT AVAILABLE
			2 - TTY NOT ASSIGNED TO THIS JOB
			3 - NO CHANNELS ARE AVAILABLE
		   COBOL:
			ITYPE IS A COMPUTATIONAL ITEM WHICH WILL
			CONTAIN AN ERROR TYPE VALUE AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  ITYPE IS DEFINED AS:
			ITYPE PIC 9(10) COMP.

	THE INIT SUBROUTINE REQUIRES THAT THE COMMUNICATIONS TTY LINE
	BE ASSIGNED TO THE JOB IN ORDER TO USE THAT LINE IN IMAGE MODE.
	THE INIT SUBROUTINE ALSO REQUIRES THAT THE CALLING ROUTINE LEAVE
	I/O CHANNELS 16 AND 17 FREE FOR
	COMMUNICATING WITH THE COMMUNICATIONS TTY LINE.
DIAL - THE DIALER SUBROUTINE

FORTRAN CALL:
	CALL DIALF(IDIAL, N, IERROR, ITYPE)

COBOL CALL:
	ENTER MACRO DIALC USING IDIAL, N, IERROR, ITYPE

WHERE THE ARGUMENTS ARE DEFINED AS:
	IDIAL	   FORTRAN:
			IDIAL IS AN INTEGER ARRAY CONTAINING THE
			DIGITS TO BE DIALED.
			THE DIGITS MUST BE IN THE RANGE OF
			1 TO 10, STORED ONE DIGIT TO A WORD.
			THE NUMBER 14 DECIMAL WILL CAUSE A FIVE SECOND
			PAUSE IN DIALING.  THIS IS USEFUL FOR
			GETTING AN "OUTSIDE LINE" WHERE A SECOND DIAL TONE
			MUST BE WAITED FOR.
		   COBOL:
			IDIAL IS A GROUP LEVEL ITEM CONTAINING N
			(DEFINED BELOW) ELEMENTARY ITEMS DEFINED AS:
			IDIGIT- PIC 9 COMP VALUE -.
			NOTE THAT EACH DIGIT DIALED IS PLACED IN A
			SEPARATE ITEM (WORD).

	N	   FORTRAN:
			N IS THE NUMBER OF DIGITS IN THE ARRAY TO BE
			DIALED. (INCLUDING ANY PAUSE REQUESTS)
			N MUST BE LESS THAN OR EQUAL TO 16 DECIMAL.
			IF N IS ZERO, THEN NO DIAL TAKES PLACE.
			TO COMMUNICATE OVER A LEASED OR HARD WIRED LINE,
			DIAL CAN BE CALLED WITH N=0.
		   COBOL:
			N IS A COMPUTATIONAL ITEM CONTAINING THE
			NUMBER OF DIGITS TO BE DIALED.  N MUST BE
			LESS THAN OR EQUAL TO 16 DECIMAL. N IS DEFINED
			AS:
			N PIC 99 COMP VALUE -.

	IERROR	   FORTRAN:
			IERROR IS AN INTEGER VARIABLE WHICH IS SET
			TRUE (-1) IF THE DIAL WAS
			SUCCESSFUL OR TO FALSE (0) IF THE CALL DID
			NOT GO THROUGH.
		   COBOL:
			IERROR IS A COMPUTATIONAL ITEM WHICH IS SET
			TO EITHER TRUE (-1) OR FALSE (0) AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  IERROR IS DEFINED AS:
			IERROR PIC 9(10) COMP.

	ITYPE	   FORTRAN:
			ITYPE IS AN INTEGER VARIABLE WHICH IS SET TO
			THE FOLLOWING VALUES IF IERROR IS FALSE:
			0 - UNDEFINED ERROR
			1 - TTY LINE NOT A DATASET LINE
			2 - CALL DID NOT GO THROUGH
			3 - MORE THAN 16 DIGITS WERE SPECIFIED IN N
		   COBOL:
			ITYPE IS A COMPUTATIONAL ITEM WHICH WILL
			CONTAIN AN ERROR TYPE VALUE AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  ITYPE IS DEFINED AS:
			ITYPE PIC 9(10) COMP.

	AFTER COMPLETING THE CALL (IF ONE WAS SPECIFIED) THE
	DIAL SUBROUTINE DIRECTLY COUPLES THE JOB'S CONTROLING TTY WITH
	THE COMMUNICATIONS TTY LINE.  THIS ENABLES THE USER TO LOG
	ONTO THE OTHER COMPUTER AND TO START UP THE COUNTERPART 
	COMMUNICATIONS PROGRAM ON THE OTHER COMPUTER.
SEND - THE DATA SENDING SUBROUTINE

FORTRAN CALL:
	CALL SENDF(ISEND, N, IERROR, ITYPE)

COBOL CALL:
	ENTER MACRO SENDC USING ISEND, N, IERROR, ITYPE

WHERE THE ARGUMENTS ARE DEFINED AS:
	ISEND	   FORTRAN:
			ISEND IS AN INTEGER ARRAY CONTAINING THE DATA
			TO BE TRANSMITTED.  THE DATA IS
			REPRESENTED AS 8-BIT CHARACTERS PACKED
			RIGHT-ADJUSTED ONE PER WORD IN THE ARRAY.
		   COBOL:
			ISEND IS A GROUP LEVEL ITEM CONTAINING N
			ITEMS DEFINED AS:
			02 CHARX PIC X SYNC RIGHT VALUE 'X'.
			NOTE THAT EACH CHARACTER SENT REQUIRES A SEPARATE
			ITEM (WORD) AND IS POSITIONED IN BITS 30 THRU 35.
			IF "USAGE IS DISPLAY-7"
			WERE ADDED TO THE DEFINITION, THE CHARACTER
			APPEARS IN BITS 28 THRU 34 WITH BIT 35 EQUAL
			TO ZERO.

	N	   FORTRAN:
			N IS AN INTEGER VARIABLE CONTAINING THE
			NUMBER OF DATA ELEMENTS TO BE SENT.
			THERE IS NO SIZE LIMIT FOR N.  HOWEVER, THE
			COMMUNICATIONS PACKAGE WILL TRANSMIT THE ARRAY
			AS A SERIES OF MESSAGES CONTAINING UP TO 72
			DATA ELEMENTS PER MESSAGE.
			THE SIZE OF THE MESSAGES IS NORMALLY
			TRANSPARENT TO THE USER, BUT IF THE USER WANTS
			TO MINIMIZE TRANSMISSION OVERHEAD
			THEN DATA SHOULD BE PACKED INTO ARRAYS
			WHICH ARE A MULTIPLE OF 72 WORDS LONG.
		   COBOL:
			N IS A COMPUTATIONAL ITEM CONTAINING THE NUMBER
			OF CHARACTERS TO BE SENT AS DESCRIBED ABOVE FOR THE
			FORTRAN CALL.  N IS DEFINED AS:
			N PIC 9(10) VALUE -.

	IERROR	   FORTRAN:
			IERROR IS A INTEGER VARIABLE
			WHICH IS SET TRUE (-1) IF THE DATA WAS
			RECEIVED SUCCESSFULLY BY THE OTHER COMPUTER
			AND FALSE (0) IF THE OTHER COMPUTER DID NOT
			GET THE DATA.
		   COBOL:
			IERROR IS A COMPUTATIONAL ITEM WHICH IS SET
			TO EITHER TRUE (-1) OR FALSE (0) AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  IERROR IS DEFINED AS:
			IERROR PIC 9(10) COMP.

	ITYPE	   FORTRAN:
			ITYPE IS AN INTEGER VARIABLE WHICH IS SET
			TO THE FOLLOWING VALUES IF IERROR IS FALSE:
			-1 - IF THE OTHER COMPUTER IS TRYING TO TRANSMIT
			     DATA CONCURENTLY WITH THIS PROGRAM.
			N - THE NUMBER OF RETRIES BEFORE GIVING UP.

			IF IERROR IS TRUE, ITYPE WILL BE SET TO THE
			NUMBER OF TRIES THAT WERE NECESSARY BEFORE THE
			DATA WAS SUCCESSFULLY RECEIVED BY THE OTHER
			COMPUTER.
		   COBOL:
			ITYPE IS A COMPUTATIONAL ITEM WHICH WILL
			CONTAIN AN ERROR TYPE VALUE AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  ITYPE IS DEFINED AS:
			ITYPE PIC 9(10) COMP.
RECV - THE DATA RECEIVER SUBROUTINE

FORTRAN CALL:
	CALL RECVF(IRECV, N, IERROR, ITYPE)

COBOL CALL:
	ENTER MACRO RECVC USING IRECV, N, IERROR, ITYPE

WHERE THE ARGUMENTS ARE DEFINED AS:

	IRECV	   FORTRAN:
			IRECV IS AN INTEGER ARRAY INTO WHICH THE DATA
			RECEIVED FROM THE OTHER COMPUTER IS PACKED
			RIGHT ADJUSTED ONE 8-BIT CHARACTER PER WORD.
		   COBOL:
			IRECV IS A GROUP LEVEL ITEM CONTAINING N 
			ELEMENTARY ITEMS INTO WHICH EACH DATA
			CHARACTER IS RECEIVED. EACH CHARACTER EXPECTED IS DEFINED AS:
			02 CHARX PIC X SYNC RIGHT.
			NOTE THAT EACH CHARACTER RECEIVED REQUIRES
			A SEPARATE ITEM (WORD) AND IS POSITIONED IN
			BITS 30 THRU 35.  IF "USAGE
			IS DISPLAY-7" WERE ADDED TO THE DEFINITION,
			THE CHARACTER WOULD APPEAR IN BITS 28 THRU 34
			WITH BIT 35 EQUAL TO 0.

	N	   FORTRAN:
			N IS AN INTEGER VARIABLE CONTAINING THE NUMBER
			OF DATA ELEMENTS TO BE RECIEVED FROM THE OTHER
			COMPUTER.  N CAN BE ANY SIZE, BUT IT SHOULD AGREE
			WITH THE NUMBER OF DATA ELEMENTS BEING
			SENT FROM THE OTHER COMPUTER.  IF N IS SMALLER
			THAN THE NUMBER OF DATA ELEMENTS SENT FROM THE OTHER
			COMPUTER, THE FIRST N DATA ELEMENTS WILL BE
			RETURNED IN IRECV AND THE REMAINING ELEMENTS
			WILL BE LOST.
		   COBOL:
			N IS A COMPUTATIONAL ITEM CONTAINING THE
			NUMBER OF DATA CHARACTERS TO BE RECEIVED
			AS INDICATED ABOVE IN THE FORTRAN CALL. N IS DEFINED AS:
			N PIC 9(10) VALUE -.

	IERROR	   FORTRAN:
			IERROR IS AN INTEGER VARAIBLE WHICH IS SET TO
			TRUE (-1) IF THE DATA IS RECEIVED PROPERLY,
			AND SET TO FALSE (0) IF 30 SECONDS PASS BEFORE
			ANY DATA IS RECEIVED.
		   COBOL:
			IERROR IS A COMPUTATIONAL ITEM WHICH IS SET
			TO EITHER TRUE (-1) OR FALSE (0) AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  IERROR IS DEFINED AS:
			IERROR PIC 9(10) COMP.

	ITYPE	   FORTRAN:
			ITYPE IS AN INTEGER VARIABLE WHICH IS SET
			TO THE NUMBER OF DATA ELEMENTS SUCCESSFULLY
			RECEIVED BEFORE RETURNING.  IF IERROR IS TRUE,
			ITYPE WILL EQUAL N.
		   COBOL:
			ITYPE IS A COMPUTATIONAL ITEM WHICH WILL
			CONTAIN AN ERROR TYPE VALUE AS INDICATED ABOVE
			FOR THE FORTRAN CALL.  ITYPE IS DEFINED AS:
			ITYPE PIC 9(10) COMP.
HNGUP - THE DISCONNECT SUBROUTINE

FROTRAN CALL:
	CALL HNGUPF

COBOL CALL:
	ENTER MACRO HNGUPC

	THERE ARE NO ARGUMENTS TO THIS SUBROUTINE.  THE HNGUP
	SUBROUTINE RESTORES THE COMMUNICATIONS TTY LINE TO ITS NORMAL
	STATE, AND THEN HANGS UP THE MODEM IF THE TTY LINE
	IS A DATASET.  IT IS IMPORTANT TO CALL THIS SUBROUTINE BEFORE
	EXITING FROM THE COMMUNICATIONS JOB TO LEAVE THE TTY LINE
	IN A REASONABLE STATE FOR THE NEXT TRANSFER.  THIS IS ESPECIALLY
	IMPORTANT IF THE JOB'S CONTROLING TTY
	IS ALSO THE COMMUNICATIONS TTY.
MESSAGES WHICH MIGHT APPEAR ON THE CONTROLLING TTY:

? COMMUNICATIONS TTY LINE NO LONGER ASSIGNED TO JOB

	THIS IS A FATAL ERROR MESSAGE WHICH COULD APPEAR IF THE COMMUNICATIONS TTY
	WAS SOMEHOW LOST BY THE COMMUNICATIONS JOB.

?COMMUNICATIONS TTY LINE NO LONGER AVAILABLE

	THIS IS A FATAL ERROR MESSAGE WHICH OCCURS IF THE COMMUNICATIONS JOB CANNOT INIT THE
	COMMUNICATIONS TTY ANY LONGER.  THE REASON IS THE SAME AS ABOVE.

? DSK NOT AVAILABLE TO WRITE DEBUG FILE

	THIS MESSAGE AND THE NEXT ONE CAN ONLY
	APPEAR IF "FTDEBUG" IS TURNED ON IN
	DIAL.MAC.  THE MESSAGE MEANS THAT THE INIT SUBROUTINE
	COULD NOT INIT THE DISK.

? CANNOT ENTER DEBUG FILE

	THIS MESSAGE OCCURS IF THERE WAS AN ERROR WHILE TRYING
	TO ENTER THE DEBUG FILE (DEBUG.FIL).  IT MIGHT OCCUR IF THE
	DSK WERE FULL, OR DEBUG.FIL CANNOT BE SUPERCEEDED.

CONTROLING TTY IS NOW DIRECTLY CONNECTED TO COMMUNICATIONS LINE.
TYPE ^X TO CONTINUE.

	THIS MESSAGE ORIGINATES FROM THE DIAL SUBROUTINE AFTER
	SUCCESSFULLY CALLING INTO THE OTHER COMPUTER.  AT THIS POINT
	THE COMMUNICATIONS TTY LINE IS CONNECTED TO THE CONTROLLING
	TTY LINE SUCH THAT ALL CHARACTERS TYPED ON THE CONTROLING TTY
	ARE SENT OUT OVER THE COMMUNICATIONS LINE, AND ALL CHARACTERS
	RECEIVED FROM THE COMMUNICATIONS LINE ARE TYPED ON THE CONTROLING TTY.
	THIS ALLOWS THE USER TO LOG ONTO THE OTHER COMPUTER AND START
	UP A PROGRAM WHICH WILL RECEIVE OR SEND THE DESIRED DATA IN
	THE CORRECT FORMAT.  CONTROL CHARACTERS CAN BE SENT TO THE OTHER COMPUTER BY TYPING
	AN UP-ARROW (^) FOLLOWED BY THE DESIRED ASCII CHARACTER.
	FOR EXAMPLE: ^C, ^O, OR ^Z.  TO EXIT FROM THIS MODE AND RETURN
	TO THE MAIN PROGRAM, THE USER MUST TYPE A 
	CONTROL-X OR ^X (AN UP-ARROW FOLLOWED BY AN X).
.NOFILL
.NOJUSTIFY
SAMPLE PROGRAMS:

FORTRAN RECEIVER PROGRAM

	DIMENSION IRECV(100)
	CALL INITF("200043,IERROR,ITYPE)
	IF (.NOT.IERROR)GO TO 1
	CALL RECVF(IRECV,100,IERROR,ITYPE)
	IF (.NOT.IERROR)GO TO 2
	TYPE 100
	CALL HNGUPF
	CALL EXIT
1	TYPE 101
	IF (ITYPE.EQ.1)TYPE 102
	IF (ITYPE.EQ.2)TYPE 103
	CALL HNGUPF
	CALL EXIT
2	TYPE 104,ITYPE
	CALL HNGUPF
	CALL EXIT
100	FORMAT(' SUCCESSFUL TRANSFER')
101	FORMAT(' COMM LINE INITIALIZATION FAILURE')
102	FORMAT(' TTY NOT AVAILABLE')
103	FORMAT(' TTY NOT ASSIGNED')
104	FORMAT(' TIME OUT AFTER RECEIVING 'I3,
     X  ' OUT OF 100 WORDS')
	END
FORTRAN SENDER PROGRAM

	DIMENSION ISEND(100),IDIAL(9)
	DATA IDIAL/9,14,8,9,7,5,7,10,2/
	CALL INITF("200046,IERROR,ITYPE)
	IF (.NOT.IERROR)GO TO 1
	CALL DIALF(IDIAL,9,IERROR,ITYPE)
	IF (.NOT.IERROR)GO TO 3
	CALL SENDF(ISEND,100,IERROR,ITYPE)
	IF (.NOT.IERROR)GO TO 2
	TYPE 100
	CALL HNGUPF
	CALL EXIT
1	TYPE 101
	IF (ITYPE.EQ.1)TYPE 102
	IF (ITYPE.EQ.2)TYPE 103
	CALL HNGUPF
	CALL EXIT
2	TYPE 104,ITYPE
	CALL HNGUPF
	CALL EXIT
3	TYPE 105
	IF (ITYPE.EQ.1)TYPE 106
	IF (ITYPE.EQ.2)TYPE 107
	CALL HNGUPF
	CALL EXIT
100	FORMAT(' SUCCESSFUL TRANSFER')
101	FORMAT(' COMM LINE INITIALIZATION FAILURE')
102	FORMAT(' TTY NOT AVAILABLE')
103	FORMAT(' TTY NOT ASSIGNED')
104	FORMAT(' TIME OUT AFTER RECEIVING 'I3,
     X  ' OUT OF 100 WORDS')
105	FORMAT(' ERROR IN DIAL')
106	FORMAT(' TTY NOT A DATASET')
107	FORMAT(' CALL DID NOT GO THROUGH')
	END
COBOL EXAMPLE PROGRAM

IDENTIFICATION DIVISION.
PROGRAM-ID. DIAL  .
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77  IOINDX        PIC 9(10) COMP VALUE 65548.
77  IERROR       PIC 9(10) COMP.
77  ITYPE        PIC 9(10) COMP.
77  N            PIC 999 COMP.
01  IDIAL.
    02  IDIG1		PIC 99 COMP VALUE 9.
    02  IDIG2		PIC 99 COMP VALUE 14.
    02  IDIG3		PIC 99 COMP VALUE 8.
    02  IDIG4		PIC 99 COMP VALUE 9.
    02  IDIG5		PIC 99 COMP VALUE 7.
    02  IDIG6		PIC 99 COMP VALUE 5.
    02  IDIG7		PIC 99 COMP VALUE 7.
    02  IDIG8		PIC 99 COMP VALUE 10.
    02  IDIG6		PIC 99 COMP VALUE 2.
01  ISEND.
    02  CHAR1		PIC X SYNC RIGHT VALUE 'A'.
    02  CHAR2		PIC X SYNC RIGHT VALUE 'B'.
    02  CHAR3		PIC X SYNC RIGHT VALUE 'C'.
    02  CHAR4		PIC X SYNC RIGHT VALUE 'D'.
    02  CHAR5		PIC X SYNC RIGHT VALUE 'E'.
    02  CHAR6		PIC X SYNC RIGHT VALUE 'F'.
    02  CHAR7		PIC X SYNC RIGHT VALUE 'G'.
    02  CHAR8		PIC X SYNC RIGHT VALUE 'H'.
    02  CHAR9		PIC X SYNC RIGHT VALUE 'I'.
    02  CHAR10		PIC X SYNC RIGHT VALUE 'J'.
01  IRECV.
    02  CHARX		PIC X SYNC RIGHT OCCURS 10 TIMES.
PROCEDURE DIVISION.
RECEIVER-ROUTINE.
    ENTER MACRO INITC USING IOINDX, IERROR, ITYPE.
    IF IERROR NOT EQUAL TO 0 GO TO ONE.
     MOVE 10 TO N.
    ENTER MACRO RECVC USING IRECV, N, IERROR, ITYPE.
    IF IERROR NOT EQUAL TO 0 GO TO TWO.
    DISPLAY 'SUCCESSFUL TRANSFER'.
    ENTER MACRO HNGUPC.
    STOP RUN.
ONE.
    DISPLAY 'COMMUNICATIONS LINE INITIALIZATION FAILURE'.
    IF ITYPE EQUAL TO 1 DISPLAY 'TTY NOT AVAILABLE'.
    IF ITYPE EQUAL TO 2 DISPLAY 'TTY NOT ASSIGNED'.
    ENTER MACRO HNGUPC.
    STOP RUN.
TWO.
    DISPLAY 'TIME OUT AFTER RECEIVING ' ITYPE ' WORDS'.
    ENTER MACRO HNGUPC.
    STOP RUN.

SENDER-SUBROUTINE.
    ENTER MACRO INITC USING IOINDX, IERROR, ITYPE.
    IF IERROR EQUAL TO 0 GO TO ONES.
    MOVE 9 TO N.
    ENTER MACRO DIALC USING IDIAL, N, IERROR, ITYPE.
    IF IERROR EQUAL TO 0 GO TO THREES.
    MOVE 10 TO N.
    ENTER MACRO SENDC USING ISEND, N, IERROR, ITYPE.
    IF IERROR EQUAL TO 0 GO TO TWOS.
    DISPLAY 'SUCCESSFUL TRANSFER'.
    ENTER MACRO HNGUPC.
    STOP RUN.
ONES.
    DISPLAY 'COMMUNICATIONS LINE INITIALIZATION FAILURE'.
    IF ITYPE EQUAL TO 1 DISPLAY 'TTY NOT AVAILABLE'.
    IF ITYPE EQUAL TO 2 DISPLAY 'TTY NOT ASSIGNED'.
    ENTER MACRO HNGUPC.
    STOP RUN.
TWOS.
    DISPLAY 'TIME OUT AFTER SENDING ' ITYPE ' WORDS'.
    ENTER MACRO HNGUPC.
    STOP RUN.
THREES.
    DISPLAY 'ERROR IN DIAL'.
    IF ITYPE EQUAL TO 1 DISPLAY 'TTY NOT A DATASET'.
    IF ITYPE EQUAL TO 2 DISPLAY 'CALL DID NOT GO THROUGH'.
    ENTER MACRO HNGUPC.
    STOP RUN.