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

INHUTC5.m

Go to the documentation of this file.
  1. INHUTC5 ;KN,bar; 26 Sep 97 22:03; Interface Message/Error Search
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;;COPYRIGHT 1997 SAIC
  1. ;
  1. ; Interface Message/Error Search Part II (INHUTC5)
  1. ; This sub-module contains functions FIND, MSGTEST, and ERRTEST.
  1. Q
  1. FIND(INQUIT,INOPT,INIEN,INSRCH) ; Build IEN message
  1. ;
  1. ; Description: Based on search type INSRCH("TYPE"), the function
  1. ; FIND loops through global ^INTHU or ^INTHER from the date-start
  1. ; to date-end and calls MSGTEST or ERRTEST to build the list of
  1. ; matching records. The matching records will be stored
  1. ; in array INIEN. FIND will stop depending on set parameters
  1. ; and return the stop reason.
  1. ;
  1. ; Parameters:
  1. ; INQUIT = Search status at stop (returned)
  1. ; 1 = max found reached
  1. ; 2 = max search reached
  1. ; 3 = no more to search
  1. ; 4 = user abort
  1. ; error = error text
  1. ; INOPT = Array of user defined options and run parameters
  1. ; INIEN = Array to store found records, pass by reference
  1. ; used with indirection ie; @INIEN@(X) (returned)
  1. ; INSRCH = Array of search criteria, pass by reference
  1. ; Optional. Only needed if calling repeatedly
  1. ; So values do not need to be rebuilt with each call
  1. ;
  1. N INA,IND,INM,INX,INFND,INTYPE,INFILE,INRVSRCH
  1. ; get search criteria values
  1. I '$D(INSRCH) S INQUIT=$$GATHER^INHUTC6($G(INOPT("CRITERIA")),.INSRCH) Q:'INQUIT
  1. ; setup file stuff, search starting point, listing direction
  1. S INTYPE=$G(INSRCH("TYPE")),INFILE=$G(INSRCH("FILENAME")),IND=$G(INSRCH("IND")),INRVSRCH=$S('INSRCH("INORDER"):-1,1:1)
  1. ; set counters and stop values
  1. S INSRCH("INSRCHCT")=$G(INOPT("INSRCHCT")),INSRCH("INFNDCT")=$G(INOPT("INFNDCT"))
  1. S INSRCH("FNDSTP")=$S($D(INOPT("MAXFND")):INSRCH("INFNDCT")+INOPT("MAXFND"),1:0)
  1. S INSRCH("SRCHSTP")=$S($D(INOPT("MAXSRCH")):INSRCH("INSRCHCT")+INOPT("MAXSRCH"),1:0)
  1. ; Loop through date/time
  1. S INQUIT=0 F D Q:INQUIT
  1. . S IND=$O(@INFILE@("B",IND),INRVSRCH) I 'IND S INQUIT=3 Q
  1. . ; check for stop dates
  1. . I (INRVSRCH>-1)&(IND>INSRCH("INEND")) S INQUIT=3 Q
  1. . I (INRVSRCH=-1)&(IND<INSRCH("INSTART")) S INQUIT=3 Q
  1. . ; loop thru entries
  1. . ; do not quit loop at this level. this value is not held
  1. . ; and entries will be skipped on next call.
  1. . S INM="" F S INM=$O(@INFILE@("B",IND,INM),INRVSRCH) Q:'INM D
  1. .. ; increment search count, check for stop
  1. .. S INSRCH("INSRCHCT")=INSRCH("INSRCHCT")+1
  1. .. I INSRCH("SRCHSTP"),INSRCH("INSRCHCT")'<INSRCH("SRCHSTP") S INQUIT=2
  1. .. ; test entry for match on criteria
  1. .. S INFND=0
  1. .. D:INTYPE="TRANSACTION" MSGTEST^INHUTC51(.INFND,INM,.INSRCH)
  1. .. D:INTYPE="ERROR" ERRTEST^INHUTC51(.INFND,INM,.INSRCH)
  1. .. ;IHS branch
  1. .. I '$$SC^INHUTIL1 D Q
  1. ... Q:'INFND
  1. ... S INSRCH("INFNDCT")=INSRCH("INFNDCT")+1
  1. ... D SETTMP^INHUTC52(INM,.INSRCH)
  1. .. ; if found inc count, check for stop
  1. .. I INFND D
  1. ... S INSRCH("INFNDCT")=INSRCH("INFNDCT")+1
  1. ... I INSRCH("FNDSTP"),INSRCH("INFNDCT")'<INSRCH("FNDSTP") S INQUIT=1
  1. ... ; format the return string for entry INM
  1. ... I '$D(INOPT("DISPFORMAT")) S @INIEN@(INSRCH("INFNDCT"))=INM
  1. ... E X INOPT("DISPFORMAT")
  1. .. ; Merge to ^Utility if memory is low
  1. .. I INIEN'["^",$S<INSRCH("SPACE") N INX S INX=INIEN,INIEN="^UTILITY(""INL"","_$J_")" K @INIEN M @INIEN=@INX K @INX,INX
  1. .. ; every 100 searched...
  1. .. I '(INSRCH("INSRCHCT")#100) D
  1. ... ; update search screen
  1. ... D:$D(DWLRF) DISPCNT
  1. ... ; allow user to abort on long search
  1. ... I $E(IOST)="C" R %#1:0 S:%="^" INQUIT=4
  1. ; update ListMan if needed
  1. I $D(DWLRF) S $P(@DWLRF,U,2)=$S(INQUIT>2:0,1:+INSRCH("INFNDCT")) D DISPCNT
  1. ; save off values for next call,return count to caller by setting values in INOPT
  1. S INSRCH("IND")=$S(INQUIT>2:"",1:IND),INOPT("INSRCHCT")=INSRCH("INSRCHCT"),INOPT("INFNDCT")=INSRCH("INFNDCT")
  1. I '$G(INOPT("NONINTER")) D
  1. . I INQUIT=4 D MS(INST_" Search Aborted.",1) Q
  1. . I INQUIT=3,INOPT("INFNDCT")=0 D MS("No "_INST_"s found that match critieria.",1)
  1. Q
  1. ;
  1. DISPCNT ; display count on screen, called only from FIND
  1. D MS("SEARCHING... Searched:"_$J(INSRCH("INSRCHCT"),8)_" Found:"_$J(INSRCH("INFNDCT"),8))
  1. Q
  1. ;
  1. MS(INX,INCR) ;print message on 23th line
  1. Q:'$$SC^INHUTIL1 ;Don't go here if IHS
  1. N DX,DY,% S DY=22,DX=0,DWDM=1 X DWXY,DIJC("N") W $E(INX,1,80)_$J("",IOM-$L(INX))
  1. I $G(INCR) S %=$$CR^UTSRD
  1. Q
  1. ;