INHERR4 ;DJL; 17 Nov 97 11:59;Interface - Error Search
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;
GATHER(INSRCH,INDA,IND,INRVSRCH) ; Collect search criteria data
; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
; DESCRIPTION: Gather the list of user selected search criteria and
; manipulate IND search starting variable depending on
; the INVRSRCH flag setting. Notify the user if the
; search may span a large numbe of errors and give
; the option of discontinuing the search
; RETURN = none
; PARAMETERS:
; INSRCH(PBR) = Array for holding search criteria information
; INDA(PBV) = Unique IEN into ^INTHU(4001.1) where ^DWC puts the
; user entered search criteria information
; IND(PBR) = The starting time/date of the search set from information
; in INSRCH and determined by INRVSRCH flag
; INRVSRCH(PBR) = Flag set user indicating direction of the search
; -1 = (default)a reverse listing order. Newest to Oldest
; 1 = a forward search listing order. Oldest to Newest
; CODE BEGINS
N X,INSRCHST,INSRCHEN,INNODE,INTEMP,INEND,INSTART
S INNODE=1
F X="INSTART","INDEST","INSTAT","INID","INSOURCE","INDIR","INORIG","INPAT","INTEMP","INTYPE","INORDER","INEXPAND" S INSRCH(X)=$G(^DIZ(4001.1,INDA,INNODE)),INNODE=INNODE+1
S INNODE=1,INTEMP=$G(^DIZ(4001.1,INDA,15))
F X="INMSGSTART","INMSGEND","INERLOC","INERSTAT" S INSRCH(X)=$P(INTEMP,U,INNODE),INNODE=INNODE+1
I $D(^DIZ(4001.1,INDA,9,0)) S INNODE=0 F S INNODE=$O(^DIZ(4001.1,INDA,9,INNODE)) Q:'INNODE S INSRCH("INTEXT")=INNODE,INSRCH("INTEXT",INNODE)=^DIZ(4001.1,INDA,9,INNODE,0)
; obtain Error date information
S INSTART=INSRCH("INSTART"),(INSRCH("INEND"),INEND)=$G(^DIZ(4001.1,INDA,1.1))
D GETDATE(.INSTART,.INEND) S INSRCH("INSTART")=INSTART,INSRCH("INEND")=INEND
; obtain Message date information
I $G(INSRCH("INMSGSTART"))!$G(INSRCH("INMSGEND")) D
. S INSTART=$G(INSRCH("INMSGSTART")),INEND=$G(INSRCH("INMSGEND"))
. D GETDATE(.INSTART,.INEND) S INSRCH("INMSGSTART")=INSTART,INSRCH("INMSGEND")=INEND
; set the search string match type (AND/OR)
S:($D(INSRCH("INTEXT"))>9)&('INSRCH("INTYPE")) (INSRCH("INTYPE"),^DIZ(4001.1,INDA,10))=0
; set the search starting point, (listing direction dependent)
S:'$G(INSRCH("INORDER")) (INSRCH("INORDER"),^DIZ(4001.1,INDA,11))=0
S IND=$S('INSRCH("INORDER"):INSRCH("INEND"),1:INSRCH("INSTART"))
S INRVSRCH=$S('INSRCH("INORDER"):-1,1:1)
Q
;
GETDATE(INSTART,INEND) ; setup the date/time
; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
; DESCRIPTION: Set the start and end times appropriately
; for a search by assigning END if not set,
; setting to the start of end of the day selected,
; and arranging the start and end variables
; to a Past-to-Recent ordering.
; RETURN = none
; PARAMETERS:
; INSTART(PBR) = Variable containing the start date
; INEND(PBR) = Variable containing the end date
; CODE BEGINS
N INTEMP
S INEND=$G(INEND),INSTART=$G(INSTART)
; if no START date was defined default to the BEGINNING of time (M time)
S:'INSTART INSTART=1800
S:'INEND!(INEND=DT) INEND=DT_".24"
; Take care a special case of start date
S:(INEND\1=INEND)&(INSTART\1=INEND) INEND=INEND+.999999
I (INEND-INSTART)<0 D
. ; a RECENT to PAST search criteria
. S:((INEND\1)=INEND) INEND=INEND-.0000001
. S INTEMP=INSTART,INSTART=INEND
. I (INTEMP\1)=INTEMP S INEND=INTEMP+.999999
. I (INTEMP\1)'=INTEMP S INEND=INTEMP
E D
. ; a PAST to RECENT search criteria
. I ((INEND\1)=INEND) S INEND=INEND+.999999
. E S INEND=INEND+.000099 ; Because second resolution can not be entered
. S INSTART=INSTART-.0000001
Q
;
SRCHSIZE(INSRCH,INFILE) ; Determine the expected search size
; MODULE NAME: SRCHSIZE ( Determine the expected Search Size )
; DESCRIPTION: Determine the expected number of errors that will
; be searched. Warn of very large searches and provide
; a mechanism to abort the search.
; Uses the Start-Date and End-Date of span to search to
; determine the size(approximate).
; RETURNS: -1 = The user aborted the search
; Number of errors in the search
; PARAMETERS:
; INSRCH(PBR) = Array for holding search criteria information
; INFILE(PBV) = The file/global to use
; CODE BEGINS
N INSRCHEN,INSRCHST,INTEMP,INMSGCT,INSIZE,INWRNSZ
; INWRNSZ= the water-mark on when to notify the user of the search size
S INWRNSZ=5000,INSIZE=0,INTEMP=$O(@INFILE@(INSRCH("INSTART")))
I INTEMP,(INTEMP<INSRCH("INEND")) S INSRCHST=$O(@INFILE@(INTEMP,"")),INTEMP=$O(@INFILE@(INSRCH("INEND")),-1),INSRCHEN=$O(@INFILE@(INTEMP,""),-1),(INMSGCT,INSIZE)=(INSRCHEN-INSRCHST)+1
I INTEMP,(INTEMP<INSRCH("INEND")),(INMSGCT>INWRNSZ) D
. W !! D ERR^INHMS2("WARNING: Approximate search size="_INMSGCT_" errors. This may take awhile.")
. I '$$YN^UTSRD("Do you want to continue with THIS search? ") S INSIZE=-1
Q INSIZE
;
INHERR4 ;DJL; 17 Nov 97 11:59;Interface - Error Search
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;
GATHER(INSRCH,INDA,IND,INRVSRCH) ; Collect search criteria data
+1 ; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
+2 ; DESCRIPTION: Gather the list of user selected search criteria and
+3 ; manipulate IND search starting variable depending on
+4 ; the INVRSRCH flag setting. Notify the user if the
+5 ; search may span a large numbe of errors and give
+6 ; the option of discontinuing the search
+7 ; RETURN = none
+8 ; PARAMETERS:
+9 ; INSRCH(PBR) = Array for holding search criteria information
+10 ; INDA(PBV) = Unique IEN into ^INTHU(4001.1) where ^DWC puts the
+11 ; user entered search criteria information
+12 ; IND(PBR) = The starting time/date of the search set from information
+13 ; in INSRCH and determined by INRVSRCH flag
+14 ; INRVSRCH(PBR) = Flag set user indicating direction of the search
+15 ; -1 = (default)a reverse listing order. Newest to Oldest
+16 ; 1 = a forward search listing order. Oldest to Newest
+17 ; CODE BEGINS
+18 NEW X,INSRCHST,INSRCHEN,INNODE,INTEMP,INEND,INSTART
+19 SET INNODE=1
+20 FOR X="INSTART","INDEST","INSTAT","INID","INSOURCE","INDIR","INORIG","INPAT","INTEMP","INTYPE","INORDER","INEXPAND"
SET INSRCH(X)=$GET(^DIZ(4001.1,INDA,INNODE))
SET INNODE=INNODE+1
+21 SET INNODE=1
SET INTEMP=$GET(^DIZ(4001.1,INDA,15))
+22 FOR X="INMSGSTART","INMSGEND","INERLOC","INERSTAT"
SET INSRCH(X)=$PIECE(INTEMP,U,INNODE)
SET INNODE=INNODE+1
+23 IF $DATA(^DIZ(4001.1,INDA,9,0))
SET INNODE=0
FOR
SET INNODE=$ORDER(^DIZ(4001.1,INDA,9,INNODE))
IF 'INNODE
QUIT
SET INSRCH("INTEXT")=INNODE
SET INSRCH("INTEXT",INNODE)=^DIZ(4001.1,INDA,9,INNODE,0)
+24 ; obtain Error date information
+25 SET INSTART=INSRCH("INSTART")
SET (INSRCH("INEND"),INEND)=$GET(^DIZ(4001.1,INDA,1.1))
+26 DO GETDATE(.INSTART,.INEND)
SET INSRCH("INSTART")=INSTART
SET INSRCH("INEND")=INEND
+27 ; obtain Message date information
+28 IF $GET(INSRCH("INMSGSTART"))!$GET(INSRCH("INMSGEND"))
Begin DoDot:1
+29 SET INSTART=$GET(INSRCH("INMSGSTART"))
SET INEND=$GET(INSRCH("INMSGEND"))
+30 DO GETDATE(.INSTART,.INEND)
SET INSRCH("INMSGSTART")=INSTART
SET INSRCH("INMSGEND")=INEND
End DoDot:1
+31 ; set the search string match type (AND/OR)
+32 IF ($DATA(INSRCH("INTEXT"))>9)&('INSRCH("INTYPE"))
SET (INSRCH("INTYPE"),^DIZ(4001.1,INDA,10))=0
+33 ; set the search starting point, (listing direction dependent)
+34 IF '$GET(INSRCH("INORDER"))
SET (INSRCH("INORDER"),^DIZ(4001.1,INDA,11))=0
+35 SET IND=$SELECT('INSRCH("INORDER"):INSRCH("INEND"),1:INSRCH("INSTART"))
+36 SET INRVSRCH=$SELECT('INSRCH("INORDER"):-1,1:1)
+37 QUIT
+38 ;
GETDATE(INSTART,INEND) ; setup the date/time
+1 ; MODULE NAME: GATHER ( Search Criteria Gathering Routine )
+2 ; DESCRIPTION: Set the start and end times appropriately
+3 ; for a search by assigning END if not set,
+4 ; setting to the start of end of the day selected,
+5 ; and arranging the start and end variables
+6 ; to a Past-to-Recent ordering.
+7 ; RETURN = none
+8 ; PARAMETERS:
+9 ; INSTART(PBR) = Variable containing the start date
+10 ; INEND(PBR) = Variable containing the end date
+11 ; CODE BEGINS
+12 NEW INTEMP
+13 SET INEND=$GET(INEND)
SET INSTART=$GET(INSTART)
+14 ; if no START date was defined default to the BEGINNING of time (M time)
+15 IF 'INSTART
SET INSTART=1800
+16 IF 'INEND!(INEND=DT)
SET INEND=DT_".24"
+17 ; Take care a special case of start date
+18 IF (INEND\1=INEND)&(INSTART\1=INEND)
SET INEND=INEND+.999999
+19 IF (INEND-INSTART)<0
Begin DoDot:1
+20 ; a RECENT to PAST search criteria
+21 IF ((INEND\1)=INEND)
SET INEND=INEND-.0000001
+22 SET INTEMP=INSTART
SET INSTART=INEND
+23 IF (INTEMP\1)=INTEMP
SET INEND=INTEMP+.999999
+24 IF (INTEMP\1)'=INTEMP
SET INEND=INTEMP
End DoDot:1
+25 IF '$TEST
Begin DoDot:1
+26 ; a PAST to RECENT search criteria
+27 IF ((INEND\1)=INEND)
SET INEND=INEND+.999999
+28 ; Because second resolution can not be entered
IF '$TEST
SET INEND=INEND+.000099
+29 SET INSTART=INSTART-.0000001
End DoDot:1
+30 QUIT
+31 ;
SRCHSIZE(INSRCH,INFILE) ; Determine the expected search size
+1 ; MODULE NAME: SRCHSIZE ( Determine the expected Search Size )
+2 ; DESCRIPTION: Determine the expected number of errors that will
+3 ; be searched. Warn of very large searches and provide
+4 ; a mechanism to abort the search.
+5 ; Uses the Start-Date and End-Date of span to search to
+6 ; determine the size(approximate).
+7 ; RETURNS: -1 = The user aborted the search
+8 ; Number of errors in the search
+9 ; PARAMETERS:
+10 ; INSRCH(PBR) = Array for holding search criteria information
+11 ; INFILE(PBV) = The file/global to use
+12 ; CODE BEGINS
+13 NEW INSRCHEN,INSRCHST,INTEMP,INMSGCT,INSIZE,INWRNSZ
+14 ; INWRNSZ= the water-mark on when to notify the user of the search size
+15 SET INWRNSZ=5000
SET INSIZE=0
SET INTEMP=$ORDER(@INFILE@(INSRCH("INSTART")))
+16 IF INTEMP
IF (INTEMP<INSRCH("INEND"))
SET INSRCHST=$ORDER(@INFILE@(INTEMP,""))
SET INTEMP=$ORDER(@INFILE@(INSRCH("INEND")),-1)
SET INSRCHEN=$ORDER(@INFILE@(INTEMP,""),-1)
SET (INMSGCT,INSIZE)=(INSRCHEN-INSRCHST)+1
+17 IF INTEMP
IF (INTEMP<INSRCH("INEND"))
IF (INMSGCT>INWRNSZ)
Begin DoDot:1
+18 WRITE !!
DO ERR^INHMS2("WARNING: Approximate search size="_INMSGCT_" errors. This may take awhile.")
+19 IF '$$YN^UTSRD("Do you want to continue with THIS search? ")
SET INSIZE=-1
End DoDot:1
+20 QUIT INSIZE
+21 ;