| 1 | ZIBTCP  ; IHS/ADC/GTH - TCP PRINT TEST ; [ 02/07/97   3:02 PM ] | 
|---|
| 2 | ;;4.0;XB;;Jul 20, 2009;Build 2 | 
|---|
| 3 | ; | 
|---|
| 4 | ; | 
|---|
| 5 | ; This routine must be DONE from the CLOSE EXECUTE when | 
|---|
| 6 | ; printing to a TCP printer.  See below for further | 
|---|
| 7 | ; documentation. | 
|---|
| 8 | ; | 
|---|
| 9 | ; H = Host IP address | 
|---|
| 10 | ; P = Port number | 
|---|
| 11 | ; I = Counter | 
|---|
| 12 | ; | 
|---|
| 13 | EN      ; | 
|---|
| 14 | D EN1 | 
|---|
| 15 | EXIT    ; | 
|---|
| 16 | S ZIBX="rm XM"_ZIBH_".DAT",ZIBX=$$JOBWAIT^%HOSTCMD(ZIBX) | 
|---|
| 17 | KILL ^TMP($J,"XM"_ZIBH),ZIBH,ZIBIO,ZIBI,ZIBX | 
|---|
| 18 | Q | 
|---|
| 19 | ; | 
|---|
| 20 | EN1     ; | 
|---|
| 21 | NEW H,P,I | 
|---|
| 22 | S ZIBIO=ION,ZIBIO=$O(^%ZIS(1,"B",ZIBIO,0)),ZIBH=DUZ_$G(ZIBH) | 
|---|
| 23 | Q:'ZIBIO | 
|---|
| 24 | Q:'$D(^%ZIS(1,ZIBIO,90)) | 
|---|
| 25 | S H=$P(^%ZIS(1,ZIBIO,90),U,2),P=$P(^(90),U,3) | 
|---|
| 26 | D OPEN | 
|---|
| 27 | Q:'$D(IO) | 
|---|
| 28 | U IO:(::0) | 
|---|
| 29 | F I=1:1 R X:300 S %X=$ZC Q:%X<0  S ^TMP($J,"XM"_ZIBH,I)=X | 
|---|
| 30 | D ^%ZISC | 
|---|
| 31 | O 56::99 | 
|---|
| 32 | U 56::"TCP" | 
|---|
| 33 | W /SOCKET(H,P) | 
|---|
| 34 | S X=0 | 
|---|
| 35 | F  S X=$O(^TMP($J,"XM"_ZIBH,X)) Q:X=""  W ^TMP($J,"XM"_ZIBH,X)_$C(10)_$C(13) | 
|---|
| 36 | W !,#,! | 
|---|
| 37 | C 56 | 
|---|
| 38 | Q | 
|---|
| 39 | ; | 
|---|
| 40 | OPEN    ;OPEN HOST FILE | 
|---|
| 41 | F ZIBI=1:1:4 S (IOP,ION)="HOST FILE SERVER #"_ZIBI,%ZIS("IOPAR")="(""XM"_ZIBH_".DAT"":""R"")" D ^%ZIS Q:'POP | 
|---|
| 42 | I POP H 2 G OPEN | 
|---|
| 43 | KILL IOP | 
|---|
| 44 | Q | 
|---|
| 45 | ; | 
|---|
| 46 | ; Technical Notes: | 
|---|
| 47 | ; MSM TCP uses the "!" to clear the TCP buffer.  FileMan (RPMS) | 
|---|
| 48 | ; uses "!" for a carriage return, line feed.  Further, TCP does not | 
|---|
| 49 | ; recognize "?30" as 30 spaces from left margin.  To circumvent these | 
|---|
| 50 | ; problems, I write to a temporary host file, which formats the | 
|---|
| 51 | ; document, and then I read it back into the TMP global.  Once it's | 
|---|
| 52 | ; in the TMP global, I $O through the global and write each line | 
|---|
| 53 | ; with a $C(10) and $C(13) concatenated to the string.  This process | 
|---|
| 54 | ; handles the CR/LF problem at the remote end. | 
|---|
| 55 | ; | 
|---|
| 56 | ; Port 2501 is the assigned port from the vendor for the Net Que. | 
|---|
| 57 | ; | 
|---|
| 58 | ; As of 3Jan95, this has only been tested on the Unix platform using | 
|---|
| 59 | ; MSM.  It should work in a DOS environment using FTP Software's TCP, | 
|---|
| 60 | ; but needs to be tested. | 
|---|
| 61 | ; | 
|---|
| 62 | ; Below is an inquiry of the Device file and Terminal Type file. | 
|---|
| 63 | ; | 
|---|
| 64 | ; OUTPUT FROM WHAT FILE: DEVICE// | 
|---|
| 65 | ;   NAME: P-TCP TEST PRINTER                $I: 51 | 
|---|
| 66 | ;   ASK DEVICE: YES                       ASK PARAMETERS: NO | 
|---|
| 67 | ;   VOLUME SET(CPU): TUC                  SIGN-ON/SYSTEM DEVICE: NO | 
|---|
| 68 | ;   FORCED QUEUING: N0 | 
|---|
| 69 | ;   LOCATION OF TERMINAL: MAT PARKENSON PRINTER | 
|---|
| 70 | ;   ASK HOST FILE: NO                     MARGIN WIDTH: 255 | 
|---|
| 71 | ;   FORM FEED: #                          PAGE LENGTH: 256 | 
|---|
| 72 | ;   BACK SPACE: $C(8)   OPEN PARAMETERS: ("XM"_DUZ_$G(ZIBH)_".DAT":"M") | 
|---|
| 73 | ;   SUBTYPE: P-TCP PRINTER                TYPE: HOST FILE SERVER | 
|---|
| 74 | ; | 
|---|
| 75 | ; Select TERMINAL TYPE NAME: P-TCP PRINTER | 
|---|
| 76 | ;   NAME: P-TCP PRINTER                     SELECTABLE AT SIGN-ON: NO | 
|---|
| 77 | ;   RIGHT MARGIN: 255                     FORM FEED: # | 
|---|
| 78 | ;   PAGE LENGTH: 256                      BACK SPACE: $C(8) | 
|---|
| 79 | ;   OPEN EXECUTE: S XMREC="R X#255:1"     CLOSE EXECUTE: D ^ZIBTCP Q | 
|---|
| 80 | ;   DESCRIPTION: Special Terminal Type used only for P-TCP Printer | 
|---|
| 81 | ;                Device.. | 
|---|