source: WorldVistAEHR/trunk/r/MAILMAN-XM/XMRFTP.m@ 1450

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

initial load of WorldVistAEHR

File size: 2.2 KB
Line 
1XMRFTP ;(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 N %,%0,%1,%2,I,X,XMIO
30 S XMIO=$I,%=^XMBX(4.2995,Z,0),%0=$P(%,U,5),%2=$P(%,U,4)
31 I '%0 S $P(^XMBX(4.2995,Z,0),U,5)=Y,%=$$EXPORT^MAGAPI("MAIL",F,"WAIT") Q %
32 S %=$P(^MAG(2005,%2,0),U,2)
33CONT S %0="XMS"_$E(Z,$L(Z)-4,$L(Z))_".LIS"
34 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
35 S X="FPQ^XMRFTP",@^%ZOSF("TRAP"),X=$ZC(%SPAWN,"PURGE "_%0)
36FPQ I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
37 S X="Q0^XMRFTP",@^%ZOSF("TRAP"),X=$ZC(%SPAWN,"DIR/OUTPUT="_%0_" NFA0:[EXPORT.MAIL]"_%)
38 O %0 U %0
39 I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
40 S X="FCHKQ^XMRFTP",@^%ZOSF("TRAP")
41 F R X:9 Q:X[%
42FCHKQ C %0 U XMIO
43 I X'[% Q 1
44 Q 0
45Q0 Q 1
46FER N X S X=$P($G(^XMBX(4.2995,Z,0)),U,2)
47 I 'X S X=$H*86400+$P($H,",",2),$P(^(0),U,2)=X
48 Q:$H*86400+$P($H,",",2)-%>99
49 N Z S XMDUZ=.5,XMSUB="ERROR moving File from Image Server"
50 S XMTEXT="A(",A(1)="The error was: "_%_"."
51 S A(2)="The COM file being processed was: "_Y,XMY(.5)=""
52 D ^XMD Q
53IMAGENT(Y,F) ;
54 N %,%0,XMIO,X
55 I ^%ZOSF("OS")["MSM" S X=$ZOS(12,NEWPATH,"") I $P(X,U)=F QUIT "5 -IMAGE ALREADY THERE"
56 S Z=$P($H,",",2)#1000,XMIO=$I,%=F
57 G CONT
Note: See TracBrowser for help on using the repository browser.