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

INTQRY.m

Go to the documentation of this file.
  1. INTQRY ;DS/SAIC; 21 May 99 15:57; Utilities for GIS query/response
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;
  1. Q
  1. ;
  1. UPDTUIF(INTSK,INTSKDT,INUIF) ; Insert the INHF TASK NUMBER and
  1. ; TASK DATE/TIME into the Univ Interface file.
  1. ; "AT" xref ^INTHU("AT",INTSK,UIF)="" is created by FileMan
  1. ;
  1. ; Input:
  1. ; INTSK (req) = GIS Format Background Controller Task Number
  1. ; INTSKDT (req) = date/time task submitted to Format Controller
  1. ; in FileMan format CYYMMDD.HHMMSS
  1. ; INUIF (req) = IEN for the message in Univ. Interface file
  1. ;
  1. N DA,DIE,DR
  1. S INTSK=$G(INTSK),INTSKDT=$G(INTSKDT),INUIF=$G(INUIF)
  1. Q:'INTSK
  1. Q:'INTSKDT
  1. Q:'INUIF
  1. S DR="4.01////"_INTSK_";"_"4.02////"_INTSKDT,DIE="^INTHU(",DA=INUIF
  1. D ^DIE
  1. Q
  1. ;
  1. SRCH(INTSK,INUIFARY,INSTATUS) ; Search for query responses
  1. ;
  1. ; Input:
  1. ; INTSK (req) = IEN for a given task number
  1. ; INUIFARY = Passed by ref, this function builds the list of
  1. ; all query responses with their status or if
  1. ; complete, ACK_UIF MESSAGE ID.
  1. ; 'E' for ERROR
  1. ; ACK_UIF MESSAGE ID, of the response entry
  1. ; in the Univ Interface File.
  1. ; INSTATUS = Passed by ref, if exists, we return
  1. ; the activity status codes with their date/time in
  1. ; the following format:
  1. ; INSTATUS(MSGID,STATUS)=FileMan DATE/TIME
  1. ; Output:
  1. ; zero, if no pending responses
  1. ; INACK^INNOACK where INACK is the number of responses received
  1. ; INNOACK is the number of pending responses
  1. ;
  1. ;
  1. N INACK,INACKUIF,INDATA,INDEST,INMSGDIR,INNOACK,INSTAT,INUIFIEN
  1. ;
  1. S INTSK=$G(INTSK) Q:'INTSK 0
  1. K INUIFARY
  1. ; If no pending query response, return zero
  1. I '$D(^INTHU("AT",INTSK)) Q 0
  1. S (INUIFIEN,INNOACK,INACK)=0
  1. F S INUIFIEN=$O(^INTHU("AT",INTSK,INUIFIEN)) Q:'INUIFIEN D
  1. .;
  1. .; build an array for all query responses, data level will have the
  1. .; status if still waiting for a response, otherwise it will contain
  1. .; the ACK_UIF MESSAGE ID that points back to the reply entry in the
  1. .; Universal Interface File.
  1. .;
  1. . S INDATA=$G(^INTHU(INUIFIEN,0)),INACKUIF=$P(INDATA,U,18),INSTAT=$P(INDATA,U,3)
  1. . I INSTAT'="C"!('INACKUIF) D Q
  1. .. S INNOACK=INNOACK+1,INUIFARY(INUIFIEN)=INSTAT
  1. .. D STATUS(INUIFIEN,.INSTATUS)
  1. . S INDEST=+$P(INDATA,U,2)
  1. . I $P($G(^INRHD(INDEST,0)),U)="HL REPLICATOR" D Q
  1. ..; Special processing for replicated messages
  1. .. N INACT,INACT0,INUIFPTR,INACKUIF
  1. ..; Loop thru the activity log multiple and get the replicant UIF
  1. .. S INACT=0 F S INACT=$O(^INTHU(INUIFIEN,1,INACT)) Q:'INACT D
  1. ... S INACT0=$G(^INTHU(INUIFIEN,1,INACT,0)) Q:'$L(INACT0)
  1. ... Q:$P(INACT0,U,2)'="R"
  1. ... S INUIFPTR=$P(INACT0,U,3) Q:'INUIFPTR
  1. ... Q:'$G(^INTHU(INUIFPTR,0))
  1. ... S INACKUIF=$P(^INTHU(INUIFPTR,0),U,18)
  1. ... S INUIFARY(INUIFPTR)=$$GETMSGID(INACKUIF),INACK=INACK+1
  1. ... D STATUS(INUIFIEN,.INSTATUS)
  1. . S INMSGID=$$GETMSGID(INACKUIF),INUIFARY(INUIFIEN)=INMSGID,INACK=INACK+1
  1. . D STATUS(INUIFIEN,.INSTATUS)
  1. Q INACK_"^"_INNOACK
  1. ;
  1. STATUS(INUIFIEN,INSTATUS) ; return detail activity info in INSTATUS array
  1. ; in the following format:
  1. ;
  1. ; INSTATUS(MESSAGEID,"C") = FileMan Date/Time (Completed)
  1. ; INSTATUS(MESSAGEID,"S") = FileMan Date/Time (Sent)
  1. ; INSTATUS(MESSAGEID,"T") = FileMan Date/Time (Format Controller Task)
  1. ; INSTATUS(MESSAGEID,"SEQUENCE") = Sequence Number
  1. ;
  1. N INACT,INACT0,INMSGID,INSEQ,INSTAT
  1. ;
  1. K INSTATUS
  1. S INUIFIEN=$G(INUIFIEN),INMSGID=$$GETMSGID(INUIFIEN) Q:'$L(INMSGID)
  1. S INSEQ=$P($G(^INTHU(INUIFIEN,0)),U,17)
  1. I $L(INSEQ) S INSTATUS(INMSGID,"SEQUENCE")=INSEQ
  1. S INSTATUS(INMSGID,"T")=$P($G(^INTHU(INUIFIEN,4)),U,2)
  1. ; Loop thru the activity log multiple and get the activity info
  1. S INACT=0 F S INACT=$O(^INTHU(INUIFIEN,1,INACT)) Q:'INACT D
  1. . S INACT0=$G(^INTHU(INUIFIEN,1,INACT,0)) Q:'$L(INACT0)
  1. . S INSTAT=$P(INACT0,U,2) Q:'$L(INSTAT)
  1. . I "AECS"[INSTAT,'$D(INSTATUS(INMSGID,INSTAT)) S INSTATUS(INMSGID,INSTAT)=$P(INACT0,U)
  1. ;
  1. Q
  1. ;
  1. GETMSGID(INUIF) ; Return the message id for a given UIF
  1. ;
  1. S INUIF=$G(INUIF) Q:'INUIF ""
  1. Q $P($G(^INTHU(INUIF,0)),U,5)
  1. ;
  1. TASKNUM(INSEQ) ; return the task number for a given incoming sequence number
  1. ;
  1. ; Input:
  1. ; INSEQ (req) = Sequence number of an incoming message
  1. ; Output:
  1. ; Task Number of the original sending message
  1. ; NULL, if not successful
  1. ;
  1. N INUIF,INUIFR
  1. S INSEQ=$G(INSEQ)
  1. Q:'$L(INSEQ) ""
  1. ; get the UIF entry number for the responding message
  1. S INUIFR=$O(^INTHU("D",INSEQ,"")) Q:'INUIFR ""
  1. ; get the UIF entry number of the parent message
  1. S INUIF=$P($G(^INTHU(INUIFR,0)),U,7) Q:'INUIF ""
  1. ; return the task number of the sending message
  1. Q $P($G(^INTHU(INUIF,4)),U)
  1. ;