XMSFTPUX ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002 11:30
;;8.0;MailMan;**48**;Jun 28, 2002;Build 5
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;XXX/KCMO - Modified for UCX, added a field to the network location
;file called 'maps to reference' that can be used to map the DOS
;locations to Unix/VMS references.
;-----------------------------------------------------------------
;
;TCP/IP-FTP COMMUNICATIONS
;Send file via FTP / File located on another TCP/IP node
FTP K TEST N XMIO,OREF,LOC,FILE,IFILE S XMIO=$I
;
;Get unique number for file to send
S (XMSFTP,X)=$G(^XMBX(4.2995,"F",0))+1,^(0)=X
;
XX S LOC=$P($G(^MAG(2005,+XMSFTP("IMAGE-PTR"),0)),U,3)
S OREF=$P($G(^MAG(2005.2,LOC,589001)),U)
;
S FILE="XM"_X_".COM",IFILE="XM"_X_".INP" O FILE:NEW O IFILE:NEW U FILE
W "$! FTP COM procedure for sending binary files, UCX/XXX",!
W "$ set noon",!
W "$ ftp:=$ucx$ftp/ultrix",!
W "$ ftp /input="_IFILE_" "_XMSFTP(3),!
W "$ exit !Need to check status",! C FILE G PUT
;
;Get file from local network
S %=$G(XMSFTP(4)) W %,!
S %=$G(XMSFTP(5)) I $L(%) W %,!
W "bin",!
W "get "_$P(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
W "close",!
;
;Put file to remote location
W "open "_XMSFTP(3),! G P
;
PUT U IFILE
S %=$G(XMSFTP(6)) W "user ",%," "
P S %=$G(XMSFTP(7)) I $L(%) H 3 W %,! I $L($G(XMSFTP(7.1))) H 3 W XMSFTP(7.1),!
W "bin",!
W "lcd ",OREF,!
;
;Need to know directory on remote side
S %=$G(XMSFTP(8)) I $L(%) W "cd "_%,!
S %=$G(XMSFTP(2)) I $L(%) W "cd "_%,!
W "delete "_XMSFTP(2,"F")_";*",!
W "put ",XMSFTP(2,"F"),!
C IFILE
;
;The following code originally spawned off an FTP transaction
;immediately when the XMnnn.COM file was created. It has been
;replaced with code in XMRTCP.
;
;S %=$H*86400+$P($H,",",2)+600,%H=%\86400_","_(%#86400) D YX^%DTC S %=$P($P(Y,",")," ",2)_"-"_$P(Y," ")_"-"_$P($P(Y,"@"),", ",2)_":"_$P(Y,"@",2)
;
S X=$$FILE(FILE) K FILE,XMTMPFIL
U XMIO Q
B36 ;Calculate base 36 number
N %,N,O,I,Z S O=X,%=X#36+1 D N S Y=N
S %=X\(36)#36+1 D N S Y=N_Y
S %=X\(36*36)#36+1 D N S Y=N_Y
S %=X\(36*36*36)#36+1 D N S Y=N_Y
S X=O Q
Q
N S N=$E("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
Q
FILE(X) ;Add record to FTP list
N DD,DO,DIC,DTOUT,DUOUT,Y
S DIC="^XMBX(4.2995,",DIC(0)="LF",DIC("DR")="1///"_($H*86400+$P($H,",",2))_";2///"_$S($G(XMDUZ):XMDUZ,1:DUZ)
D FILE^DICN S %=$G(XMSFTP("IMAGE-PTR")) I % S $P(^XMBX(4.2995,+Y,0),U,4)=%
Q Y
TEST S TEST=1
;;XMSFTP(1)=get file IP address (EG 89.0.0.79 - IPv4 or 0000:0000:0000:0000:0000:FFFF:5900:004F - IPv6)
;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
;;XMSFTP(3)=put to IP address
;;XMSFTP(4)=User ID at origination node
;;XMSFTP(5)=User Password at origination node
;;XMSFTP(6)=User ID at destination node
;;XMSFTP(7)=User Password at destination node
;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
Q
;
;To display image on Pete's terminal
;>stage
;>C:\t\test3 file_name
;
;find differences: diff file1 file2 (no display=no differences)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXMSFTPUX 3194 printed Nov 22, 2024@17:23:21 Page 2
XMSFTPUX ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002 11:30
+1 ;;8.0;MailMan;**48**;Jun 28, 2002;Build 5
+2 ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+3 ;XXX/KCMO - Modified for UCX, added a field to the network location
+4 ;file called 'maps to reference' that can be used to map the DOS
+5 ;locations to Unix/VMS references.
+6 ;-----------------------------------------------------------------
+7 ;
+8 ;TCP/IP-FTP COMMUNICATIONS
+9 ;Send file via FTP / File located on another TCP/IP node
FTP KILL TEST
NEW XMIO,OREF,LOC,FILE,IFILE
SET XMIO=$IO
+1 ;
+2 ;Get unique number for file to send
+3 SET (XMSFTP,X)=$GET(^XMBX(4.2995,"F",0))+1
SET ^(0)=X
+4 ;
XX SET LOC=$PIECE($GET(^MAG(2005,+XMSFTP("IMAGE-PTR"),0)),U,3)
+1 SET OREF=$PIECE($GET(^MAG(2005.2,LOC,589001)),U)
+2 ;
+3 SET FILE="XM"_X_".COM"
SET IFILE="XM"_X_".INP"
OPEN FILE:NEW
OPEN IFILE:NEW
USE FILE
+4 WRITE "$! FTP COM procedure for sending binary files, UCX/XXX",!
+5 WRITE "$ set noon",!
+6 WRITE "$ ftp:=$ucx$ftp/ultrix",!
+7 WRITE "$ ftp /input="_IFILE_" "_XMSFTP(3),!
+8 WRITE "$ exit !Need to check status",!
CLOSE FILE
GOTO PUT
+9 ;
+10 ;Get file from local network
+11 SET %=$GET(XMSFTP(4))
WRITE %,!
+12 SET %=$GET(XMSFTP(5))
IF $LENGTH(%)
WRITE %,!
+13 WRITE "bin",!
+14 WRITE "get "_$PIECE(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
+15 WRITE "close",!
+16 ;
+17 ;Put file to remote location
+18 WRITE "open "_XMSFTP(3),!
GOTO P
+19 ;
PUT USE IFILE
+1 SET %=$GET(XMSFTP(6))
WRITE "user ",%," "
P SET %=$GET(XMSFTP(7))
IF $LENGTH(%)
HANG 3
WRITE %,!
IF $LENGTH($GET(XMSFTP(7.1)))
HANG 3
WRITE XMSFTP(7.1),!
+1 WRITE "bin",!
+2 WRITE "lcd ",OREF,!
+3 ;
+4 ;Need to know directory on remote side
+5 SET %=$GET(XMSFTP(8))
IF $LENGTH(%)
WRITE "cd "_%,!
+6 SET %=$GET(XMSFTP(2))
IF $LENGTH(%)
WRITE "cd "_%,!
+7 WRITE "delete "_XMSFTP(2,"F")_";*",!
+8 WRITE "put ",XMSFTP(2,"F"),!
+9 CLOSE IFILE
+10 ;
+11 ;The following code originally spawned off an FTP transaction
+12 ;immediately when the XMnnn.COM file was created. It has been
+13 ;replaced with code in XMRTCP.
+14 ;
+15 ;S %=$H*86400+$P($H,",",2)+600,%H=%\86400_","_(%#86400) D YX^%DTC S %=$P($P(Y,",")," ",2)_"-"_$P(Y," ")_"-"_$P($P(Y,"@"),", ",2)_":"_$P(Y,"@",2)
+16 ;
+17 SET X=$$FILE(FILE)
KILL FILE,XMTMPFIL
+18 USE XMIO
QUIT
B36 ;Calculate base 36 number
+1 NEW %,N,O,I,Z
SET O=X
SET %=X#36+1
DO N
SET Y=N
+2 SET %=X\(36)#36+1
DO N
SET Y=N_Y
+3 SET %=X\(36*36)#36+1
DO N
SET Y=N_Y
+4 SET %=X\(36*36*36)#36+1
DO N
SET Y=N_Y
+5 SET X=O
QUIT
+6 QUIT
N SET N=$EXTRACT("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
+1 QUIT
FILE(X) ;Add record to FTP list
+1 NEW DD,DO,DIC,DTOUT,DUOUT,Y
+2 SET DIC="^XMBX(4.2995,"
SET DIC(0)="LF"
SET DIC("DR")="1///"_($HOROLOG*86400+$PIECE($HOROLOG,",",2))_";2///"_$SELECT($GET(XMDUZ):XMDUZ,1:DUZ)
+3 DO FILE^DICN
SET %=$GET(XMSFTP("IMAGE-PTR"))
IF %
SET $PIECE(^XMBX(4.2995,+Y,0),U,4)=%
+4 QUIT Y
TEST SET TEST=1
+1 ;;XMSFTP(1)=get file IP address (EG 89.0.0.79 - IPv4 or 0000:0000:0000:0000:0000:FFFF:5900:004F - IPv6)
+2 ;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
+3 ;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
+4 ;;XMSFTP(3)=put to IP address
+5 ;;XMSFTP(4)=User ID at origination node
+6 ;;XMSFTP(5)=User Password at origination node
+7 ;;XMSFTP(6)=User ID at destination node
+8 ;;XMSFTP(7)=User Password at destination node
+9 ;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
+10 QUIT
+11 ;
+12 ;To display image on Pete's terminal
+13 ;>stage
+14 ;>C:\t\test3 file_name
+15 ;
+16 ;find differences: diff file1 file2 (no display=no differences)