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

INHES2.m

Go to the documentation of this file.
  1. INHES2 ;KN; 9 Sep 96 13:51; Calling routine for the INHES Module.
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. ; MODULE NAME: INTERFACE ERROR SUMMARY (INHES2)
  1. ;
  1. ;
  1. INSUM(INSRCH,INAR) ;Summary routine
  1. ;
  1. ; Description:
  1. ; The INSUM is used to search global ^INTHER Interface Error File
  1. ; from the start date to the end/date. It will group the error
  1. ; messages according to the text length, report the count for each
  1. ; group. It also collects details for the first and last occurences
  1. ; of each group occurs and of error messages such as: Transaction type,
  1. ; Message ID, Error loc, Destination and Background process.
  1. ;
  1. ; Return: None
  1. ;
  1. ; Parameters:
  1. ; INSRCH = Array of criteria
  1. ; INAR = Array of IEN
  1. ;
  1. ; Code begins:
  1. N INKA
  1. S INRVSRCH=$G(INSRCH("INORDER"))
  1. S INKA="INARDET"
  1. ; get the count, first and last occurence IEN
  1. D INSUMP(.INSRCH,.INAR,.INKA)
  1. ; INKD is the display array
  1. ; INKD is the array that contains the error text and all the details
  1. ; for the first and last occurences.
  1. S INKD="INARDIS"
  1. ; get all the details message and store in display array INKD
  1. D GETERR(.INKA,.INKD)
  1. W:($P(IOST,"-")["C") @IOF D HSET^INHES,HEADER^INHES
  1. ; display summary report
  1. S INX="" F S INX=$O(@INKD@(INX)) Q:INX="" D
  1. . D NP Q:$G(DUOUT) W !,$G(@INKD@(INX)),?7,INX
  1. . F INJ=1:1:2 D
  1. .. Q:'$D(@INKD@(INX,INJ))
  1. .. I INRVSRCH=0 D NP Q:$G(DUOUT) W !?5,$S(INJ=1:"Latest",INJ=2:"Earliest")," occurence: ",$G(@INKD@(INX,INJ)),?45,$E($G(@INKD@(INX,INJ,4)),1,30)
  1. .. I INRVSRCH=1 D NP Q:$G(DUOUT) W !?5,$S(INJ=1:"Earliest",INJ=2:"Latest")," occurence: ",$G(@INKD@(INX,INJ)),?45,$E($G(@INKD@(INX,INJ,4)),1,30)
  1. .. D NP Q:$G(DUOUT) W !?5,$E($G(@INKD@(INX,INJ,1)),1,30),?45,$E($G(@INKD@(INX,INJ,2)),1,30)
  1. .. D NP Q:$G(DUOUT) W !?5,$E($G(@INKD@(INX,INJ,3)),1,30),?45,$E($G(@INKD@(INX,INJ,5)),1,30),!
  1. K @INKA,INKA,@INKD,INKD
  1. ; Display the total report
  1. D NP Q:$G(DUOUT) W !!,"TOTAL ERROR : ",$G(INSRCH("FOUND"))," TOTAL SEARCH : ",$G(INSRCH("TOTAL"))
  1. ; call function to display the "end of report"
  1. W !!,$J("",30)_"*** End of Report ***"
  1. I ($P(IOST,"-")["C")&('$D(IO("Q")))&(IO=IO(0))&(INPAGE>0) Q:$G(DUOUT) W ! D ^UTSRD("Press <RETURN> to continue or ^ to Quit;;;;;;;0;;;;DTIME;;X","","",1) S:(X=1)!(X=2) DUOUT=1
  1. Q:$G(DUOUT)
  1. Q
  1. ;
  1. NP ; New page
  1. I $Y>(IOSL-5) D HEADER^INHES
  1. Q
  1. ; The function SEARCH is reused code from the INHERR
  1. ; Module Name: SEARCH ( Interface Error Search Routine )
  1. ;
  1. ; Description: Prompts the user for search criteria to be used
  1. ; to find matches in the Interface Error File
  1. ; file (^INTHER). The user is presented with a list
  1. ; of matching items which can be selectively expanded
  1. ; or printed(user chosen device). The user is then
  1. ; brought back to the Search Criteria menu and can
  1. ; continue with another search or exit with the F10 key.
  1. ; Return: none
  1. ; Parameters: none
  1. ;
  1. ; Code begins
  1. N INDA,INQUIT,INFNDNAM,INSELECT,INPARM2
  1. S INFNDNAM="INMSGS" N @INFNDNAM
  1. ; Create the list processor help text
  1. S INPARM2("HELP")="N INHELP D BLDHELP^INHERR3(.INHELP),SRCHHELP^INHERR3(.INHELP)"
  1. ; Create the list processor TITLE text
  1. S INPARM2("TITLE")="W ?IOM-$L(""Interface Error Summary"")/2,""Interface Error Summary"""
  1. F S INFNDNAM="INMSGS" S INQUIT=$$BGNSRCH^INHERR(.INFNDNAM,1,.INDA,.INPARM2,1) Q:$S(INQUIT=0:0,INQUIT=4:0,1:1) D:$O(@INFNDNAM@(0)) POST^INHERR2(INFNDNAM,"INH ERROR DISPLAY",4003) K @INFNDNAM
  1. D:+INDA INKINDA^INHMS(INDA)
  1. Q
  1. ;
  1. GETERR(INKA,INKD) ; get error messages
  1. ;
  1. ; Description: The GETERR is used to given the IEN for the first and
  1. ; last occurance in INKA array, get details for the error
  1. ; messages such as: Transaction Type, Destination, Message
  1. ; ID, Error location, Background process and store in
  1. ; display array INKD parameter.
  1. ; Return: None
  1. ;
  1. ; Parameters:
  1. ; INKA = array of IEN for the first and last occuence
  1. ; INKD = display array
  1. ;
  1. ; Code begins:
  1. ; loop through INKA array to get all info and convert date
  1. S INT="" F S INT=$O(@INKA@(INT)) Q:INT="" D
  1. .F INJ=1:1:2 D
  1. .. Q:'$D(@INKA@(INT,INJ)) S INIEN=$G(@INKA@(INT,INJ)),@INKD@(INT)=$G(@INKA@(INT))
  1. ..; acquire the .01 field for errors and messages
  1. .. S INERRTXT=$G(^INTHER(INIEN,0)),INMSGTXT=$S(+$P(INERRTXT,U,4):$G(^INTHU($P(INERRTXT,U,4),0)),1:"")
  1. ..; get the date
  1. .. S Y=$P(^INTHER(INIEN,0),"^") D DD^%DT S @INKD@(INT,INJ)=$G(Y)
  1. ..; transaction type
  1. .. S INETTYPE=$S(+$P(INERRTXT,U,2):+$P(INERRTXT,U,2),+$P(INMSGTXT,U,11):+$P(INMSGTXT,U,11),1:"None") S:+INETTYPE @INKD@(INT,INJ,1)=$P($G(^INRHT(INETTYPE,0)),U)
  1. ..; error location
  1. .. S INELOC=$S(+$P(INERRTXT,U,5):+$P(INERRTXT,U,5),1:"None") S:+INELOC @INKD@(INT,INJ,2)=$P($G(^INTHERL(INELOC,0)),U)
  1. ..; destination
  1. .. S INEDEST=$S(+$P(INERRTXT,U,9):+$P(INERRTXT,U,9),+$P(INMSGTXT,U,2):+$P(INMSGTXT,U,2),1:"None") S:+INEDEST @INKD@(INT,INJ,3)=$P($G(^INRHD(INEDEST,0)),U)
  1. .. S @INKD@(INT,INJ,4)=$S($L($P(INMSGTXT,U,5)):$P(INMSGTXT,U,5),1:"None")
  1. ..; background process
  1. .. S INBGDPR=$S(+$P(INERRTXT,U,11):+$P(INERRTXT,U,11),1:"None") S:+INBGDPR @INKD@(INT,INJ,5)=$P($G(^INTHPC(INBGDPR,0)),U)
  1. ..; Merge to file if array too large
  1. .. I $S<20000 N INTMPY S INTMPY=INKD,INKD="^UTILITY($J,""INAD"")" K @INKD M @INKD=@INTMPY K @INTMPY,INTMPY
  1. Q
  1. ;
  1. INSUMP(INSRCH,INAR,INKA) ;Summary routine
  1. ;
  1. ; Description: The INSUM is used to search global ^INTHER Interface
  1. ; Error File. Get the count for each group of the
  1. ; error messages according to select text length. It
  1. ; also calculate the count, save the IEN for the first
  1. ; and the last occurence for each group of the messages.
  1. ;
  1. ; Return: None
  1. ;
  1. ; Parameters:
  1. ; INSRCH = Array of the criteria
  1. ; INAR = Array of IEN
  1. ; INKA = Array of count, ien for the first and last occurence
  1. ;
  1. ; Code begins:
  1. N INT,INTIM,INENODE
  1. S INEXLN=$G(INSRCH("TEXTLEN"))
  1. ; INKA is an array that contains the error count for each group
  1. ; and also the first and last occurences IEN.
  1. ; Maximum text lenght is 120 due to system restriction for MERGE
  1. I $G(INEXLN)>120 S INEXLN=120
  1. ;INX is ien from inar array
  1. S INT=0
  1. F S INT=$O(@INAR@(INT)) Q:'INT D
  1. .; Loop through multiple node and concat the error message text
  1. . S INENODE=0,OK=1,INX=$G(@INAR@(INT)),INTXT=""
  1. . F S INENODE=$O(^INTHER(INX,2,INENODE)) Q:'INENODE!'OK D
  1. .. S INLV=$G(^INTHER(INX,2,INENODE,0))
  1. .. S:$L(INTXT)+$L(INLV)>120 OK=0 Q:'OK
  1. .. S INTXT=$G(INTXT)_INLV
  1. . S INTXT=$$UPCASE^%ZTF($E(INTXT,1,$G(INEXLN)))
  1. . I INTXT="" S INTXT="No Error Text"
  1. .; store in display array INKA, if memory is full, merge to ^UTILITY
  1. . I $S<20000 N INTMPY S INTMPY=INKA,INKA="^UTILITY($J,""INAC"")" K @INKA M @INKA=@INTMPY K @INTMPY,INTMPY
  1. . S @INKA@(INTXT)=$G(@INKA@(INTXT))+1
  1. .; save the ien of first and last occurance
  1. . I '$D(@INKA@(INTXT,1)) S @INKA@(INTXT,1)=INX
  1. . E S @INKA@(INTXT,2)=INX
  1. Q