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

XMDIR1.m

Go to the documentation of this file.
  1. XMDIR1 ;(WASH ISC)/CAP-Load VACO Directories ;04/17/2002 08:47
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Entry points used by MailMan options (not covered by DBIA):
  1. ; OPTION XMMGR-DIRECTORY-VACO
  1. Q
  1. ENT ;Batch Entry point (TaskMan)
  1. K ZTREQ,^TMP("XMDIR1",$J) S XMA=0
  1. ;
  1. ;LOCK to indicate to XMA5 that MailLink in being updated
  1. L +^XMD("XMDIR1"):1 E G RES:$D(ZTQUEUED) W !!,$C(7),"<<< This task seems to be running already !",!,"(It cannot be run multiple times concurrently.) >>>" G Q
  1. ;
  1. U IO(0) S XMDIR1A("CODE")=$S($G(XMDIR1A)=1:"1A",1:"1B")
  1. I '$D(ZTQUEUED) W !!,"Killing off old AUTOMATIC entries for this code ("_XMDIR1A("CODE")_").",!!
  1. N DIK
  1. S DA=0,DIK="^XMD(4.2997,"
  1. F XMA0=1:1 S DA=$O(^XMD(4.2997,"E",XMDIR1A("CODE"),DA)) Q:+DA'=DA D ^DIK I '$D(ZTQUEUED),XMA0#10=0 W "."
  1. ;
  1. ;Kill off very old manual entries that haven't been used
  1. S DA=0,XMDIR1=$E(DT,1,5)-200,XMDIR1("CNT")=0
  1. F XMA0=XMA0:1 S DA=$O(^XMD(4.2997,"AC",DA)) Q:$S(DA>XMDIR1:1,DA="":1,1:0) D ^DIK I '$D(ZTQUEUED),XMA0#10=0 W "."
  1. ;
  1. I '$D(ZTQUEUED) W !!,"Starting load",!!
  1. U IO
  1. ;Load WANG directory
  1. I $G(XMDIR1A("CODE"))="1A" D ^XMDIR1A
  1. ;
  1. ;Load NOAVA directory
  1. I $G(XMDIR1A("CODE"))="1B" D ^XMDIR1B
  1. ;
  1. K XMDIR1A,XMDIR1B
  1. I '$D(ZTQUEUED) W !!!,"Task Completed"
  1. ;
  1. S ^TMP("XMDIR1",$J,.0001)="Remote Directories summary:"
  1. S ^TMP("XMDIR1",$J,.0002)=""
  1. I $D(XMDIR1("W")) S ^TMP("XMDIR1",$J,.0003)=XMDIR1("W")_" Wang system records processed."
  1. I $D(XMDIR1("N")) S ^TMP("XMDIR1",$J,.0003)=XMDIR1("N")_" NOAVA system records processed."
  1. S XMSUB="REMOTE DIRECTORY AUTOMATIC UPDATE",XMTEXT="^TMP(""XMDIR1"",$J,"
  1. N XMDUZ S XMDUZ="|XMDIR1_REMOTE_DIRECTORY_UPDATE|",XMY("G.POSTMASTER@"_^XMB("NETNAME"))=""
  1. I $D(DUZ) S XMY(DUZ)=""
  1. I $O(XMY(0))="" S XMY(.5)=""
  1. D ^XMD K A
  1. Q L -^XMD("XMDIR1") K ^TMP("XMDIR1",$J)
  1. Q
  1. ;
  1. ;Menu option to schedule task
  1. OPTION G ENT:$D(ZTQUEUED)
  1. N %,%0,%1,%6,D,DA,I,J,X,Y,XMA0,XMB0,XMC0,XMDUZ,XMDIR1,XMSUB,XMY,XMTEXT
  1. W !!,"You are about to load a file containing a list of names and"
  1. W !,"addresses into you Remote User Directory (file 4.2997). This"
  1. W !,"file originated either from a NOAVA system or a WANG system."
  1. W !,"Choose the correct file. We will check it some for format.",!!
  1. S %ZIS("S")="I $P($G(^(""TYPE"")),U)[""HFS"""
  1. S %ZIS("A")="Enter either HFS-WANG-DIR or HFS-NOAVA-DIR: "
  1. S %ZIS("B")="HFS-NOAVA-DIR"
  1. S %ZIS="Q" D ^%ZIS Q:POP
  1. S XMF=IO,XMDIR1A=$S(ION="HFS-NOAVA-DIR":2,1:1)
  1. R !!,"Do you want your job queued? (Answer YES or NO) NO// ",X:DTIME
  1. K D S:X="" X="NO" S X=$TR(X,"noyes","NOYES") I $E("YES",1,$L(X))=X S D=1
  1. W !!,"Before the update occurs entries older than 90 days in the directory"
  1. W !,"are deleted if they were automatically filed by this procedure."
  1. W !,"Manually entered entries are deleted if they haven't been used"
  1. W !,"for at least 2 years."
  1. W !!,"Users are informed that an update is occuring if they are using"
  1. W !,"MailLink help options. But are allowed to continue.",!!
  1. R !!,"Are you sure you want to do this (Answer 'YES/NO'): NO//",X:DTIME
  1. S:X="" X="NO" S X=$TR(X,"noyes","NOYES") I $E("YES",1,$L(X))'=X W !!,"Nothing done.",$C(7),!! Q
  1. I '$G(D) G INT
  1. D ZTSK W !!,$C(7),"Task #"_ZTSK_" scheduled.",!!
  1. D ^%ZISC K ZTSK,ZTRTN,ZTDTH,XMDUZ,ZTDESC,IO("Q"),XMDIR1A,XMDIR1B
  1. Q
  1. ER ;Display error
  1. S XMDIR1("CNT")=XMDIR1("CNT")+1,^TMP("XMDIR1",$J,XMDIR1("CNT"))=XME_":"_XMY Q
  1. ZTSK ;Schedule to run in the evening
  1. S XMDUZ="[XMDIR1_DIRECTORY_CONVERSION]",ZTRTN="ENT^XMDIR1",ZTDTH=+$H_",64800",ZTSAVE("*")="",ZTDESC="Convert MailLink list"
  1. S ZTDTH="" D ^%ZTLOAD Q
  1. ;Job out this process from here
  1. JOB S ZTQUEUED=1,U="^",(IO,IO(0))="" D DT^DICRW G XMDIR1
  1. ;Reschedule job to run later
  1. RES S ZTREQ=$$HADD^XLFDT($H,,,5)_"^^MailLink Conversion Restart @ "_$H_"^XMZWANG" Q
  1. HFSFILE S DIC="^%ZIS(1,",DIC(0)="AZQME",DIC("S")="I $P($G(^%ZIS(1,Y,""TYPE"")),U)[""HFS"""
  1. D ^DIC Q:Y<0
  1. S IOP=X D ^%ZIS Q:POP
  1. S XMF=$P(^%ZIS(1,IOS,0),U,2) Q
  1. INT ;Interactive processing begins here
  1. S XMF=$P(^%ZIS(1,IOS,0),U,2)
  1. W !!,"Answer 'YES' if you mean 'YES'. All other response mean 'NO'."
  1. W !,"The first file to be processed is for the "_XMF_"."
  1. W !,"Enter '^' to skip this portion of the process.",!!
  1. I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP=""
  1. S X="NOWANG^XMDIR1B",@^%ZOSF("TRAP")
  1. U IO R Y:1 U IO(0)
  1. W !!,"The following string was read from the first line of "_XMF_"."
  1. W !!,Y,!!,"Is this correct ? NO// " R %:DTIME
  1. S:%="" %="NO" S %=$TR(%,"noyes","NOYES")
  1. I $E("YES",1,$L(%))'=% D ^%ZISC Q
  1. W ! G ENT