source: FOIAVistA/trunk/r/MAILMAN-XM/XMSFTP.m@ 1169

Last change on this file since 1169 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1XMSFTP ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002 11:29
2 ;;8.0;MailMan;;Jun 28, 2002
3 ;TCP/IP-FTP COMMUNICATIONS
4 ;Send file via FTP / File located on another TCP/IP node
5FTP K TEST N XMIO S XMIO=$I
6 ;
7 ;Get unique number for file to send
8 S (XMSFTP,X)=$G(^XMBX(4.2995,"F",0))+1,^(0)=X
9 ;
10 S FILE="XM"_X_".COM" O FILE:NEW U FILE
11 W "$! FTP COM procedure for fetching file from server and sending it",!
12 W "$ set noon",!
13 W "$ assign/user nla0: sys$output",! ;Turn off echo
14 W "$ assign/user sys$input sys$command",!
15 ;
16 ;FTP to Get or Put location
17 W "$ FTP=""$TWG$TCP:[NETDIST.USER]FTP",!
18 W "$ FTP "
19 I $L($G(XMSFTP(1))) W XMSFTP(1),!
20 E W XMSFTP(3),! G PUT
21 ;
22 ;Get file from local network
23 S %=$G(XMSFTP(4)) W %,!
24 S %=$G(XMSFTP(5)) I $L(%) W %,!
25 W "bin",!
26 W "get "_$P(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
27 W "close",!
28 ;
29 ;Put file to remote location
30 W "open "_XMSFTP(3),! G P
31PUT S %=$G(XMSFTP(6)) W %,!
32P S %=$G(XMSFTP(7)) I $L(%) H 3 W %,! I $L($G(XMSFTP(7.1))) H 3 W XMSFTP(7.1),!
33 W "bin",!
34 W "cd nfa0:[IMPORT.MAIL]",!
35 ;
36 ;Need to know directory on remote side
37 S %=$G(XMSFTP(8)) I $L(%) W "cd "_%,!
38 S %=$G(XMSFTP(2)) I $L(%) W "cd "_%,!
39 W "delete "_XMSFTP(2,"F"),!
40 W "put nfa0:[EXPORT.MAIL]"_XMSFTP(2,"F"),!
41 C FILE
42 ;
43 ;The following code originally spawned off an FTP transaction
44 ;immediately when the XMnnn.COM file was created. It has been
45 ;replaced with code in XMRTCP.
46 ;
47 ;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)
48 ;
49 S X=$$FILE(FILE) K FILE,XMTMPFIL
50 U XMIO Q
51B36 ;Calculate base 36 number
52 N %,N,O,I,Z S O=X,%=X#36+1 D N S Y=N
53 S %=X\(36)#36+1 D N S Y=N_Y
54 S %=X\(36*36)#36+1 D N S Y=N_Y
55 S %=X\(36*36*36)#36+1 D N S Y=N_Y
56 S X=O Q
57 Q
58N S N=$E("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
59 Q
60FILE(X) ;Add record to FTP list
61 N DD,DO,DIC,DTOUT,DUOUT,Y
62 S DIC="^XMBX(4.2995,",DIC(0)="LF",DIC("DR")="1///"_($H*86400+$P($H,",",2))_";2///"_$S($G(XMDUZ):XMDUZ,1:DUZ)
63 D FILE^DICN S %=$G(XMSFTP("IMAGE-PTR")) I % S $P(^XMBX(4.2995,+Y,0),U,4)=%
64 Q Y
65TEST S TEST=1
66 ;;XMSFTP(1)=get file IP address (EG 89.0.0.79 - sstu)
67 ;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
68 ;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
69 ;;XMSFTP(3)=put to IP address
70 ;;XMSFTP(4)=User ID at origination node
71 ;;XMSFTP(5)=User Password at origination node
72 ;;XMSFTP(6)=User ID at destination node
73 ;;XMSFTP(7)=User Password at destination node
74 ;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
75 Q
76 ;
77 ;To display image on Pete's terminal
78 ;>stage
79 ;>C:\t\test3 file_name
80 ;
81 ;find differences: diff file1 file2 (no display=no differences)
Note: See TracBrowser for help on using the repository browser.