source: FOIAVistA/tag/r/MAILMAN-XM/XMRFTPUX.m@ 1337

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

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1XMRFTPUX ;(WASH ISC)/THM/CAP-SMTP Receiver (RFC 821) ;04/17/2002 11:20
2 ;;8.0;MailMan;;Jun 28, 2002
3 ;Modified for TCP/IP under INET_SERVERS of Wollongong
4 ;Send out FTP jobs that are due
5FTP N %,DA,DIK,XMA0,XMC0,XMSFTP,Y,Z,XMCOM S XMA0=$H*86400+$P($H,",",2)
6F1 S Z=0,Z=$O(^XMBX(4.2995,Z)) G FQ:+Z'=Z I '$D(^(Z,0)) G QQ^XMRTCP
7 S Y=^XMBX(4.2995,Z,0),XMSFTP=$P(Y,U,4),XMRTCPY="MM-FTP-"_$P(Y,U),XMCOM=$P(Y,U)
8 I XMCOM'?1"XM".E D RUNQ G QQ^XMRTCP
9F2 F S %=$S($G(XMC0):XMC0,1:$$CK^XMRTCP(1)) G F3:%
10 ;Copy file to export directory
11F3 S XMC0=% I XMSFTP S %=$$FCHK(Z,XMA0,XMSFTP) G F1:%
12 S XMRTCP("NAME")=XMRTCPY D REN
13 G RUN
14FQ I $G(XMC0) L -^XMBX("TCPCHAN-COUNT",XMC0)
15 Q
16 ;Submit FTP process
17RUN I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
18 S X="RUNQ^XMRFTP",@^%ZOSF("TRAP")
19 S %=$ZC(%SPAWN,"@"_XMCOM),%=$ZC(%SPAWN,"DELETE "_XMCOM_".*")
20RUNQ ;Remove from 4.2995
21 I $D(Z) N DIK,DA S DIK="^XMBX(4.2995,",DA=Z K XMRTCPY D ^DIK Q
22 Q
23REN I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
24 S X="DUPNAME^XMRTCP",@^%ZOSF("TRAP")
25 I ^%ZOSF("OS")["VAX" S X=$ZC(%SETPRN,$E(XMRTCP("NAME"),1,13))
26 D START^XMRTCPGO
27 Q
28FCHK(Z,Y,F) ;Is file in export directory ?
29 Q 0 ;****************
30 N %,%0,%1,%2,I,X,XMIO
31 S XMIO=$I,%=^XMBX(4.2995,Z,0),%0=$P(%,U,5),%2=$P(%,U,4)
32 I '%0 S $P(^XMBX(4.2995,Z,0),U,5)=Y,%=$$EXPORT^MAGAPI("MAIL",F,"WAIT") Q %
33 S %=$P(^MAG(2005,%2,0),U,2)
34CONT S %0="XMS"_$E(Z,$L(Z)-4,$L(Z))_".LIS"
35 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
36 S X="FPQ^XMRFTP",@^%ZOSF("TRAP"),X=$ZC(%SPAWN,"PURGE "_%0)
37FPQ I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
38 S X="Q0^XMRFTP",@^%ZOSF("TRAP"),X=$ZC(%SPAWN,"DIR/OUTPUT="_%0_" NFA0:[EXPORT.MAIL]"_%)
39 O %0 U %0
40 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
41 S X="FCHKQ^XMRFTP",@^%ZOSF("TRAP")
42 F R X:9 Q:X[%
43FCHKQ C %0 U XMIO
44 I X'[% Q 1
45 Q 0
46Q0 Q 1
47FER N X S X=$P($G(^XMBX(4.2995,Z,0)),U,2)
48 I 'X S X=$H*86400+$P($H,",",2),$P(^(0),U,2)=X
49 Q:$H*86400+$P($H,",",2)-%>99
50 N Z S XMDUZ=.5,XMSUB="ERROR moving File from Image Server"
51 S XMTEXT="A(",A(1)="The error was: "_%_"."
52 S A(2)="The COM file being processed was: "_Y,XMY(.5)=""
53 D ^XMD Q
54IMAGENT(Y,F) ;
55 N %,%0,XMIO,X
56 I ^%ZOSF("OS")["MSM" S X=$ZOS(12,NEWPATH,"") I $P(X,U)=F QUIT "5 -IMAGE ALREADY THERE"
57 S Z=$P($H,",",2)#1000,XMIO=$I,%=F
58 G CONT
Note: See TracBrowser for help on using the repository browser.