Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMSFTPUX

XMSFTPUX.m

Go to the documentation of this file.
  1. XMSFTPUX ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002 11:30
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1. ;XXX/KCMO - Modified for UCX, added a field to the network location
  1. ;file called 'maps to reference' that can be used to map the DOS
  1. ;locations to Unix/VMS references.
  1. ;-----------------------------------------------------------------
  1. ;
  1. ;TCP/IP-FTP COMMUNICATIONS
  1. ;Send file via FTP / File located on another TCP/IP node
  1. FTP K TEST N XMIO,OREF,LOC,FILE,IFILE S XMIO=$I
  1. ;
  1. ;Get unique number for file to send
  1. S (XMSFTP,X)=$G(^XMBX(4.2995,"F",0))+1,^(0)=X
  1. ;
  1. XX S LOC=$P($G(^MAG(2005,+XMSFTP("IMAGE-PTR"),0)),U,3)
  1. S OREF=$P($G(^MAG(2005.2,LOC,589001)),U)
  1. ;
  1. S FILE="XM"_X_".COM",IFILE="XM"_X_".INP" O FILE:NEW O IFILE:NEW U FILE
  1. W "$! FTP COM procedure for sending binary files, UCX/XXX",!
  1. W "$ set noon",!
  1. W "$ ftp:=$ucx$ftp/ultrix",!
  1. W "$ ftp /input="_IFILE_" "_XMSFTP(3),!
  1. W "$ exit !Need to check status",! C FILE G PUT
  1. ;
  1. ;Get file from local network
  1. S %=$G(XMSFTP(4)) W %,!
  1. S %=$G(XMSFTP(5)) I $L(%) W %,!
  1. W "bin",!
  1. W "get "_$P(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
  1. W "close",!
  1. ;
  1. ;Put file to remote location
  1. W "open "_XMSFTP(3),! G P
  1. ;
  1. PUT U IFILE
  1. S %=$G(XMSFTP(6)) W "user ",%," "
  1. P S %=$G(XMSFTP(7)) I $L(%) H 3 W %,! I $L($G(XMSFTP(7.1))) H 3 W XMSFTP(7.1),!
  1. W "bin",!
  1. W "lcd ",OREF,!
  1. ;
  1. ;Need to know directory on remote side
  1. S %=$G(XMSFTP(8)) I $L(%) W "cd "_%,!
  1. S %=$G(XMSFTP(2)) I $L(%) W "cd "_%,!
  1. W "delete "_XMSFTP(2,"F")_";*",!
  1. W "put ",XMSFTP(2,"F"),!
  1. C IFILE
  1. ;
  1. ;The following code originally spawned off an FTP transaction
  1. ;immediately when the XMnnn.COM file was created. It has been
  1. ;replaced with code in XMRTCP.
  1. ;
  1. ;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)
  1. ;
  1. S X=$$FILE(FILE) K FILE,XMTMPFIL
  1. U XMIO Q
  1. B36 ;Calculate base 36 number
  1. N %,N,O,I,Z S O=X,%=X#36+1 D N S Y=N
  1. S %=X\(36)#36+1 D N S Y=N_Y
  1. S %=X\(36*36)#36+1 D N S Y=N_Y
  1. S %=X\(36*36*36)#36+1 D N S Y=N_Y
  1. S X=O Q
  1. Q
  1. N S N=$E("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
  1. Q
  1. FILE(X) ;Add record to FTP list
  1. N DD,DO,DIC,DTOUT,DUOUT,Y
  1. S DIC="^XMBX(4.2995,",DIC(0)="LF",DIC("DR")="1///"_($H*86400+$P($H,",",2))_";2///"_$S($G(XMDUZ):XMDUZ,1:DUZ)
  1. D FILE^DICN S %=$G(XMSFTP("IMAGE-PTR")) I % S $P(^XMBX(4.2995,+Y,0),U,4)=%
  1. Q Y
  1. TEST S TEST=1
  1. ;;XMSFTP(1)=get file IP address (EG 89.0.0.79 - sstu)
  1. ;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
  1. ;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
  1. ;;XMSFTP(3)=put to IP address
  1. ;;XMSFTP(4)=User ID at origination node
  1. ;;XMSFTP(5)=User Password at origination node
  1. ;;XMSFTP(6)=User ID at destination node
  1. ;;XMSFTP(7)=User Password at destination node
  1. ;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
  1. Q
  1. ;
  1. ;To display image on Pete's terminal
  1. ;>stage
  1. ;>C:\t\test3 file_name
  1. ;
  1. ;find differences: diff file1 file2 (no display=no differences)