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

ADEXSU3.m

Go to the documentation of this file.
  1. ADEXSU3 ; IHS/HQT/MJL - DENTAL EXTRACT PART 5 ; [ 03/24/1999 9:04 AM ]
  1. ;;6.0;ADE;;APRIL 1999
  1. FIN ;EP
  1. W !,?15,"RECORDS PROCESSED: ",ADERC,!
  1. I $D(ADEERR) W !,"THE ABOVE ERRORS SHOULD BE CORRECTED BEFORE THE NEXT DENTAL DATA EXTRACTION.",! K ADEERR
  1. W !,?15,"P R O C E S S I N G C O M P L E T E D",!!
  1. D ^%ZISC
  1. I $D(ZTQUEUED),$D(ZTSK) D KILL^%ZTLOAD
  1. ;
  1. EXIT ;
  1. K ADEA,ADEADACP,ADEADAF,ADEADAQ,ADEASF,ADEASITE,ADEB,ADEBDT,ADEBS6,ADEC,ADED,ADEDF,ADEDFN,ADEDMFLG,ADEDOB,ADEEDT,ADEERR,ADEFN,ADEFNO,ADEHRN,ADEIDX,ADENAT,ADENODE,ADERC,ADERDV,ADEREPD,ADESERV,ADESEX,ADESITE,ADESUFAC,ADESVCS,ADETCOST
  1. K ADETYPE,ADEVDTE,ADEVDTP,ADEVISDT,ADEVNODE,ADEZIP,ADEZTSK,ADELAST,ADELDAY,ADEXDT,ADEDT,ADESTAT,ADEDA,ADEREX,ADECOD,ADEND,ADERR12,ADERR13,ADEXDA,ADEXNOD,ADERERUN,ADERROR
  1. K ADECHS Q
  1. ;
  1. ERR ;;Called to trap unexpected errors and resume procesing
  1. W !,"An unexpected error occurred while processing",!,"entry number ",ADEA," in the DENTAL PROCEDURE file."
  1. I $D(^%ZOSF("ERRTN")) D
  1. . W !,"Local variables at the time of the error will be saved in the error trap.",!,"Processing will RESUME after logging the error",!
  1. . I '$D(ZTQUEUED) W "and displaying an error message"
  1. . W "."
  1. . D @^%ZOSF("ERRTN")
  1. . W !!,"Now resuming dental data extraction process."
  1. S X="ERR^ADEXSU3",@^%ZOSF("TRAP")
  1. G RESTART^ADEXSU1
  1. ;
  1. TASK ;EP
  1. ;Entry point to queue for tasked monthly processing
  1. ;Check Extraction Log
  1. Q:'$D(IO)
  1. I $D(DUZ)[0 G TEND
  1. D ^XBKVAR,DT^DICRW
  1. ;Must have "@" or "[" in DUZ(0), otw quit
  1. I DUZ(0)'["@",DUZ(0)'["[" G TEND
  1. I '$D(^ADELOG("LAST","D")) G TASK1
  1. ;If last extraction abended, send notificaton bulletin and quit
  1. I $P(^ADELOG("LAST","D"),"^",2)["AB" D G TEND
  1. . S XMB="ADEX-ABEND",XMDUZ="DENTAL PACKAGE" D ^XMB
  1. ;If last extraction was today, just quit.
  1. I $P(^ADELOG("LAST","D"),U)=DT G TEND
  1. TASK1 ;Send bulletin that extraction started on device #
  1. S XMB="ADEX-START",XMB(1)=IO,XMDUZ="DENTAL PACKAGE" D ^XMB
  1. ;Set ADEBDT=First day of fiscal Year
  1. S ADEBDT=$$FY(DT)
  1. S ADEND=DT
  1. S ADEXDT=DT
  1. S ADECHS=0 S:$P(^ADEPARAM(+^AUTTSITE(1,0),0),U,6)="y" ADECHS=1
  1. ;Do Extraction (ADEXSU1)
  1. D ^ADEXSU1
  1. S ADERC=$S($D(^ADENDATA(0))=1:$P(^ADENDATA(0),U,7),1:0)
  1. ;Save file to unix host
  1. I ADERC S XBIO=51,XBMED="F",XBGL="ADENDATA" D ^XBGSAVE
  1. ;(NOTE: Change AUGSAVE to XBSAVE whenever that gets written)
  1. ;Send bulletin that extraction complete and data saved to FILE
  1. S XMB="ADEX-COMPLETE",XMDUZ="DENTAL PACKAGE"
  1. I 'ADERC S XMB(1)=0,XMB(2)="",XMB(3)="" D ^XMB G TEND
  1. ;If AUFLG=-1 Set bulletin variable to augsave error message
  1. ;contained in AUGFLG(1)
  1. S XMB(1)=ADERC
  1. I $D(AUFLG),AUFLG=-1 D D ^XMB G TEND
  1. . S XMB(2)="But the AUGSAVE routine was not able to save the extracted data to a unix file."
  1. . I $D(AUFLG(1)),AUFLG(1)]"" S XMB(2)=XMB(2)_" The error message returned from AUGSAVE was: "_AUFLG(1)
  1. . S XMB(3)="The dental data cannot be forwarded to the Area until it can be saved to a unix file. Please contact your Area Information System Coordinator or IHS Dental Headquarters (505) 262 6319."
  1. ;
  1. D D ^XMB G TEND
  1. . S XMB(2)="Data saved to unix file."
  1. . S XMB(3)="Retain a copy of the data extraction printout for your records. Coordinate with Area Headquarters to ensure that the data file is forwarded and received."
  1. TEND K AUFLG,ADEBDT,ADEND,ADEXDT,ADERC
  1. Q
  1. ;
  1. FY(ADEDT) ;;Returns beginning of ADEADEDT's fiscal year in FM form
  1. N ADEFY
  1. ;beginning Y2K fix
  1. ;S ADEFY=1001
  1. ;S ADEFY="2"_$S($E(ADEDT,4,5)<10:$E(ADEDT,2,3)-1,1:$E(ADEDT,2,3))_ADEFY
  1. S ADEFY=$P($$FISCAL^XBDT(ADEDT),U,2) ;Y2000
  1. ;end Y2K fix block
  1. Q ADEFY
  1. K ADEFY ;*NE