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

DDMP2.m

Go to the documentation of this file.
  1. DDMP2 ;SFISC/DPC-Import Device, Queuing, Reports ;11/5/97 08:10
  1. ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
  1. ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
  1. ;;Licensed under the terms of the Apache License, Version 2.0.
  1. ;
  1. DEV(DDMPIOIN,DDMPIOP) ;
  1. ;Device selection for printed report.
  1. ;DDMPIOIN might contain preselected info.
  1. ;DDMPIOP will contain device data for later use with ^%ZIS.
  1. I $D(DDMPIOIN("IOP")) D
  1. . I $P(DDMPIOIN("IOP"),";")'="Q" S DDMPIOP=DDMPIOIN("IOP")
  1. . E D
  1. . . S DDMPIOP=$P(DDMPIOIN("IOP"),";",2,99),DDMPIOP("Q")=1
  1. . . I $D(DDMPIOIN("QTIME")) D SETQTIME
  1. E D
  1. . N %ZIS,POP
  1. . S %ZIS="QN"
  1. . S %ZIS("A")="Device for Import Results Report: "
  1. . D ^%ZIS
  1. . I POP S DDMPIOP("NG")=1 Q
  1. . I $E(IOST,1,2)="C-" S DDMPIOP("HOME")=1 Q
  1. . D SETIOP
  1. . I $G(IO("Q")) S DDMPIOP("Q")=1 Q
  1. . D HOME^%ZIS
  1. . I $P(DDMPIOP,";",2)="P-BROWSER" Q
  1. . N DIR,DIRUT,Y
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Do you want to queue this data import"
  1. . D ^DIR
  1. . I $G(DIRUT) S DDMPIOP("NG")=1 Q
  1. . I Y S DDMPIOP("Q")=1
  1. Q
  1. ;
  1. SETIOP ;
  1. ;Sets up IOP, etc., from variables returned by ^%ZIS.
  1. S DDMPIOP=ION
  1. I $G(IOST)]"" S DDMPIOP=DDMPIOP_";"_IOST
  1. I $G(IO("DOC"))]"" S DDMPIOP=DDMPIOP_";"_IO("DOC") Q
  1. I $G(IOM) S DDMPIOP=DDMPIOP_";"_IOM
  1. I $G(IOSL) S DDMPIOP=DDMPIOP_";"_IOSL
  1. I $G(IOT)="HFS" S DDMPIOP("HFSNAME")=IO,DDMPIOP("HFSMODE")="W"
  1. Q
  1. ;
  1. SETQTIME ;
  1. ;Sets time for queuing from value passed in ("QTIME")
  1. N X,Y,%DT
  1. S X=DDMPIOIN("QTIME")
  1. I X="NOW" S DDMPIOP("QTIME")=$H
  1. E D
  1. . I X'["@" S X="T@"_X
  1. . S %DT="XT",%DT(0)="NOW"
  1. . D ^%DT
  1. . I Y<0 S DDMPIOP("NG")=1 Q
  1. . S DDMPIOP("QTIME")=Y
  1. Q
  1. ;
  1. QUE(DDMPIOP) ;
  1. ;Queues the import.
  1. S ZTRTN="TASK^DDMP"
  1. S ZTIO=""
  1. S ZTDESC="Queued data import."
  1. I $D(DDMPIOP("QTIME")) S ZTDTH=DDMPIOP("QTIME")
  1. S ZTSAVE("^TMP($J,""DDMP"",")=""
  1. S ZTSAVE("DDMPIOP(")=""
  1. S ZTSAVE("DDMPIOP")=""
  1. S ZTSAVE("DDMPF")=""
  1. S ZTSAVE("DDMPSQ(")=""
  1. S ZTSAVE("DDMPFMT(")=""
  1. S ZTSAVE("DDMPFLG")=""
  1. S ZTSAVE("DDMPFLG(")=""
  1. S ZTSAVE("DDMPNCNT")=""
  1. S ZTSAVE("DDMPFSRC(")=""
  1. D ^%ZTLOAD
  1. I $G(ZTSK) D
  1. . W !,"Import queued. Task number: "_ZTSK
  1. E W !,"Queuing of import failed. Import aborted."
  1. Q
  1. ;
  1. REP1(DDMPRPSB,DDMPLN) ;
  1. N DDMPI,DDMPTXT,DDMPUSR,DDMPFNO,DDMPLEN
  1. S DDMPLN=0
  1. I '$D(^XTMP("DDMP1000")) S DDMPRPSB="DDMP1000"
  1. E S DDMPRPSB="DDMP"_($P($O(^XTMP("DDMPz"),-1),"DDMP",2)+1)
  1. S ^XTMP(DDMPRPSB,0)=DT_U_DT_U
  1. S DDMPUSR=$$GET1^DIQ(200,DUZ_",",.01)
  1. S ^(0)=^XTMP(DDMPRPSB,0)_"Import report: "_DDMPUSR
  1. D LDXTMP($P($T(LN1+1),";;",2)_$P(DDMPUSR,",",2)_" "_$P(DDMPUSR,","))
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN1+2),";;",2)_DDMPFSRC("PATH")_DDMPFSRC("FILE"))
  1. D LDXTMP($P($T(LN1+3),";;",2)_DDMPFMT("FIXED"))
  1. D LDXTMP($P($T(LN1+4),";;",2)_DDMPFMT("FDELIM"))
  1. D LDXTMP($P($T(LN1+5),";;",2)_DDMPFMT("QUOTED"))
  1. D LDXTMP($P($T(LN1+6),";;",2)_$S(DDMPFLG["E":"External",1:"Internal"))
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN1+7),";;",2)_$$GET1^DID(DDMPF,"","","NAME"))
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN1+8),";;",2))
  1. D LDXTMP($P($T(LN1+9),";;",2))
  1. F DDMPI=1:1 Q:'$D(DDMPSQ(DDMPI)) D
  1. . S DDMPFNO=$P(DDMPSQ(DDMPI),"~"),DDMPLEN=$P(DDMPSQ(DDMPI),"~",4)
  1. . S DDMPTXT=DDMPI_$J("",5-$L(DDMPI))_$S(DDMPLEN:DDMPLEN,1:"n/a")
  1. . S DDMPTXT=DDMPTXT_$J("",10-$L(DDMPTXT))_$$GET1^DID(DDMPFNO,$P(DDMPSQ(DDMPI),"~",3),"","LABEL")
  1. . I DDMPF'=DDMPFNO S DDMPTXT=DDMPTXT_$J("",43-$L(DDMPTXT))_$O(^DD(DDMPFNO,0,"NM",""))
  1. . D LDXTMP(DDMPTXT)
  1. D LDXTMP("")
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN1+10),";;",2))
  1. D LDXTMP($P($T(LN1+11),";;",2))
  1. D LDXTMP("")
  1. Q
  1. ;
  1. LDXTMP(DDMPTXT) ;
  1. S DDMPLN=DDMPLN+1
  1. S ^XTMP(DDMPRPSB,DDMPLN)=DDMPTXT
  1. Q
  1. ;
  1. LN1 ;
  1. ;; Import Initiated By:
  1. ;; Source File:
  1. ;; Fixed Length:
  1. ;; Delimited By:
  1. ;; Text Values Quoted:
  1. ;; Values Are:
  1. ;; Primary FileMan Destination File:
  1. ;;Seq Len Field Name Subfile Name (if applicable)
  1. ;;--- --- ---------- ----------------------------
  1. ;; Error Report
  1. ;; ------------
  1. ;
  1. REP2(DDMPRPSB,DDMPLN,DDMPSTAT) ;
  1. N POP
  1. I '$G(DDMPSTAT("NG")) D LDXTMP($P($T(LN2+1),";;",2))
  1. D LDXTMP("")
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN2+2),";;",2))
  1. D LDXTMP($P($T(LN2+3),";;",2))
  1. D LDXTMP("")
  1. I $G(DDMPSTAT("ABORT")) D
  1. . D LDXTMP($P($T(LN2+4),";;",2))
  1. . D LDXTMP($P($T(LN2+(4+DDMPSTAT("ABORT"))),";;",2))
  1. . D LDXTMP("")
  1. D LDXTMP($P($T(LN2+7),";;",2)_DDMPSTAT("TOT"))
  1. D LDXTMP($P($T(LN2+8),";;",2)_(DDMPSTAT("TOT")-DDMPSTAT("NG")))
  1. D LDXTMP($P($T(LN2+9),";;",2)_DDMPSTAT("NG"))
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN2+10),";;",2)_$G(DDMPSTAT("FIEN"),"Nothing filed"))
  1. D LDXTMP($P($T(LN2+11),";;",2)_$G(DDMPSTAT("LIEN"),"Nothing filed"))
  1. D LDXTMP("")
  1. D LDXTMP($P($T(LN2+12),";;",2)_$$HTE^DILIBF(DDMPSTAT("BEG")))
  1. S DDMPSTAT("END")=$H
  1. D LDXTMP($P($T(LN2+13),";;",2)_$$HTE^DILIBF(DDMPSTAT("END")))
  1. D LDXTMP($P($T(LN2+14),";;",2)_$$HDIFF^DILIBF(DDMPSTAT("END"),DDMPSTAT("BEG"),3))
  1. I $G(DDMPIOP("HOME")) W @IOF D PRNTHM Q
  1. I $P($G(DDMPIOP),";",2)="P-BROWSER" D BROWSET Q:POP D PRNTHM Q
  1. ;Set up queued job for report printing.
  1. N %ZIS
  1. S %ZIS="Q"
  1. S IOP="Q;"_DDMPIOP
  1. I $D(DDMPIOP("HFSNAME")) S %ZIS("HFSNAME")=DDMPIOP("HFSNAME")
  1. I $D(DDMPIOP("HFSNODE")) S %ZIS("HFSMODE")=DDMPIOP("HFSMODE")
  1. D ^%ZIS
  1. I POP Q ;ERROR THAT REPORT CANNOT PRINT
  1. K ZTIO
  1. S ZTRTN="PRNT^DDMP2"
  1. S ZTSAVE("DDMPRPSB")=""
  1. S ZTDTH=$H
  1. S ZTDESC="Printing of Import Log for User# "_DUZ
  1. D ^%ZTLOAD
  1. I '$D(ZTQUEUED) W !,"Task Number for printing: "_ZTSK
  1. Q
  1. PRNT ;
  1. ;Tasked print of report.
  1. S ZTREQ="@"
  1. U IO
  1. PRNTHM ;Print to home device. Tasked prints fall through.
  1. N DDMPCNT,DDMPPG,DDMPIOSL,DDMPOUT
  1. S DDMPIOSL=$G(IOSL,60)
  1. S DDMPPG=0,DDMPCNT=0
  1. D HDR
  1. F S DDMPCNT=$O(^XTMP(DDMPRPSB,DDMPCNT)) Q:DDMPCNT="" D Q:$G(DDMPOUT)
  1. . W !,^XTMP(DDMPRPSB,DDMPCNT)
  1. . I $Y+3>DDMPIOSL D HDR
  1. I $E(IOST,1,2)'="C-" W @IOF D ^%ZISC
  1. Q
  1. ;
  1. BROWSET ;
  1. N %ZIS
  1. S IOP=DDMPIOP
  1. D ^%ZIS
  1. U IO
  1. Q
  1. ;
  1. HDR ;
  1. I DDMPPG,$E(IOST,1,2)="C-" N DIR,Y S DIR(0)="E" D ^DIR I 'Y S DDMPOUT=1 Q
  1. I DDMPPG W @IOF
  1. S DDMPPG=DDMPPG+1
  1. W $P($T(HDR1+1),";;",2)_DDMPPG
  1. W !,$P($T(HDR1+2),";;",2)
  1. W !
  1. Q
  1. ;
  1. HDR1 ;
  1. ;; Log for VA FileMan Data Import Page
  1. ;; ==============================
  1. LN2 ;
  1. ;; No errors occured during this data import.
  1. ;; Summary of Import
  1. ;; -----------------
  1. ;; <<<IMPORT NOT COMPLETED:
  1. ;; MAXIMUM ERRORS DETECTED>>>
  1. ;; USER ABORT OF TASKED IMPORT>>>
  1. ;; Total Records Read:
  1. ;; Total Records Filed:
  1. ;; Total Records Rejected:
  1. ;; IEN of First Record Filed:
  1. ;; IEN of Last Record Filed:
  1. ;; Import Filing Started:
  1. ;; Import Filing Completed:
  1. ;; Time of Import Filing: