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

INHUTC.m

Go to the documentation of this file.
  1. INHUTC ;bar; 23 Jul 97 15:02; Criteria Mgmt and Execution API
  1. ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
  1. ;COPYRIGHT 1991-2000 SAIC
  1. ;;COPYRIGHT 1997 SAIC
  1. ;
  1. ; MODULE NAME: Criteria Management And Execution API (INHUTC)
  1. ;
  1. ; PURPOSE:
  1. ; Support application teams with an interface to Interface
  1. ; Transaction and Error reporting functionality.
  1. ;
  1. ; DESCRIPTION:
  1. ; This module contains entry points for Interface Criteria Management,
  1. ; Transaction search and print, and Error search and print.
  1. ;
  1. ENTRY(INTYPE,INAPP,INFUNC,INCTRL,INOPT) ; simple entry point to run generic
  1. ; user-interfactive search of Interface Transactions and Error.
  1. ; input: INTYPE = "TRANSACTION" or "ERROR". Required.
  1. ; INAPP = Optional text/namespace of application. ie; "MCSC".
  1. ; INFUNC = Optional text of functionality. ie; "Scheduling"
  1. ; INCTRL = Optional CONTROL value(s)
  1. ; if INCTRL contains a "S" allow only STANDARD entries
  1. ; if INCTRL contains a "U" allow only USER entries
  1. ; if INCTRL contains a "W" allow only WORKING entries
  1. ; (if only "W", user will not be prompted)
  1. ;
  1. ;IHS does not ENV^UTIL
  1. I $$SC^INHUTIL1 D ENV^UTIL
  1. I '$$TYPE^INHUTC2($G(INTYPE)) W !," Search type required." Q
  1. ; setup inbound parameters
  1. S INOPT("TYPE")=INTYPE,INOPT("APP")=$G(INAPP),INOPT("FUNC")=$G(INFUNC),INOPT("CONTROL")=$G(INCTRL)
  1. ; setup runtime parameters
  1. S INOPT("GALLERY")="INH "_INTYPE_" SEARCH EDIT"
  1. F Q:'$$RUN^INHUTC(.INOPT)
  1. Q
  1. ;
  1. TIEN(INOPT,INARNAM) ; simple entry to retrieve a selected list of transactions
  1. ;
  1. S INOPT("TYPE")="TRANSACTION",INOPT("GALLERY")="INH TRANSACTION SEARCH EDIT",INOPT("APP")="INTERFACE",INOPT("ARRAY")=INARNAM
  1. Q $$RUN^INHUTC(.INOPT)
  1. ;
  1. GETCRIT(INOPT,INPARMS) ; Get/Create entries.
  1. ;
  1. ; Description: The function GETCRIT provides users and Programmers
  1. ; an interface to get, create, recall, edit and save a
  1. ; search entry from the Interface Criteria file.
  1. ;
  1. ; Note: Optionally pass in values. Optionally run user
  1. ; interface. Optionally save entry.
  1. ;
  1. ; Returns:
  1. ; IEN of record in INTERFACE CRITERIA file if function does not
  1. ; complete, reason text is returned. Also returns DUOUT and
  1. ; DTOUT if appropriate.
  1. ;
  1. ; Parameters:
  1. ; INOPT = Array. (Please refer to INHUTCD documentation for
  1. ; description).
  1. ; INPARMS = Array of values to stuff into criteria fields.
  1. ; The value is the base name of the array rather
  1. ; than the array itself so it can be used with
  1. ; indirection. @INPARMS@("TTYPE",1)="DG REG".
  1. ; Optional Refer to table under FIELDS^INHUTC3
  1. ; for field mnemonics.
  1. ;
  1. ; Code begins:
  1. Q $$GETCRIT^INHUTC7(.INOPT,.INPARMS)
  1. ;
  1. ;
  1. DELCRIT(DA) ; Clean-up search criteria storage data
  1. ;
  1. ; Description: The function DELCRIT is used to cleans up the search
  1. ; criteria data in the ^DIZ global by using the ^DIK
  1. ; routine.
  1. ;
  1. ; Return:
  1. ; 0 = failure
  1. ; 1 = success
  1. ; Parameters:
  1. ; INDA = IEN into ^DIZ Interface Criteria File used to search
  1. ; criteria data.
  1. ;
  1. ; Code begins:
  1. Q:'$G(DA) 0
  1. ; do not delete standard entries
  1. Q:$P($G(^DIZ(4001.1,DA,0)),U,3)="S" 0
  1. ; do not delete if locked
  1. Q:'$$LOCK(DA,1,2) 0
  1. N DIK S DIK="^DIZ(4001.1," D ^DIK
  1. ; unlock entry
  1. S %=$$LOCK(DA,0)
  1. Q 1
  1. ;
  1. ;
  1. RUN(INOPT,INPARMS) ; Run calling search and print
  1. ;
  1. ; Description: The function RUN operates into two modes:
  1. ; 1. Interactive mode: In this mode, RUN will call function
  1. ; DISPLAY to do the search, display the found entries on
  1. ; screen for selection and allow user to select print device
  1. ; to output.
  1. ; 2. Non-interactive mode: In this mode, RUN will initialize the
  1. ; device selected in the search criteria. It will create a
  1. ; background task to do the search and print to the selected
  1. ; device.
  1. ;
  1. ; Return:
  1. ; 1 = if no error
  1. ; Error text = if error occurs
  1. ;
  1. ; Parameters:
  1. ; (Same as parameters of the function SEARCH).
  1. ;
  1. ;
  1. ; Code Begins:
  1. ;
  1. Q $$RUN^INHUTC7(.INOPT,.INPARMS)
  1. ;
  1. ;
  1. ;
  1. ; Description: The function SEARCH is performed to searches global
  1. ; ^INTHU (4001) or ^INTHER (4003) for records matching the
  1. ; criteria defined in INOPT("CRITERIA") and then stores the
  1. ; found ien in array INIEN.
  1. ; The programmer can call this function within a loop.
  1. ; INOPT("INSRCHCT") and INOPT("INFNDCT")(number
  1. ; of the messages searched and number of the messages found)
  1. ; are updated by this function as an indicator for the search
  1. ; performed.
  1. ;
  1. ; Note: It is responsible of the programmer to reset the NUMBER
  1. ; OF SEARCH (INOPT("INSRCHCT") to zero when the search
  1. ; criteria changed.
  1. ;
  1. ; Return: 1 = max found reached
  1. ; 2 = max search reached
  1. ; 3 = no more to search
  1. ; 4 = user abort
  1. ; text = error text
  1. ;
  1. ; Parameters:
  1. ;
  1. ; INOPT = Array of option values passed by reference. Some
  1. ; main options are listed below. More details can be
  1. ; found in the API documentation.
  1. ; INOPT("CRITERIA") = IEN to an entry in the INTERFACE CRITERIA file.
  1. ; Search will be performed based on value in this entry.
  1. ; INIEN = List of found entry number are returned in this store
  1. ; the ien into ^INTHU global that user selected.
  1. ;
  1. ; Code Begins:
  1. N INQUIT,INSRCH
  1. Q:'$G(INOPT("CRITERIA")) "Incorrect or Missing Search Criteria"
  1. I $D(INOPT("INSRCH")) M INSRCH=INOPT("INSRCH")
  1. D FIND^INHUTC5(.INQUIT,.INOPT,.INIEN,.INSRCH)
  1. I $D(INSRCH) M INOPT("INSRCH")=INSRCH
  1. Q INQUIT
  1. ;
  1. PRINT(INOPT,INIEN) ; Display/Print messages
  1. ;
  1. ; Description: The function PRINT is used to Display/print Messages or
  1. ; Error by using INH MESSAGE/ERROR DISPLAY print template.
  1. ;
  1. ;
  1. ; Return:
  1. ; Parameters:
  1. ; INOPT = Array of options. See INHUTCD for values.
  1. ; INIEN = A NAME of an Array of IEN's into global ^INTHU or
  1. ; ^INTHER of messages or Errors selected for
  1. ; displaying/printing
  1. ;
  1. ; Code begins:
  1. Q $$PRINT^INHUTC7(.INOPT,.INIEN)
  1. ;
  1. ;
  1. LOCK(INDA,INMODE,INTIME) ; lock criteria entry
  1. ;
  1. ; Description: The function LOCK is used to manage lock and unlock
  1. ; entry in criteria file.
  1. ;
  1. ; Return:
  1. ; TRUE = success
  1. ; FAILSE = faild
  1. ; Parameters:
  1. ; INDA = entry in criteria file to lock (req)
  1. ; INMODE = 1 to lock and 0 to unlock 0 is default
  1. ; INTIME = timeout value, defaults to DTIME or 5 sec if
  1. ; DTIME is not around.
  1. ;
  1. ; Code begins:
  1. Q:'$G(INDA) 0 S:'$D(INTIME) INTIME=$G(DTIME,5)
  1. S INMODE=+$G(INMODE)
  1. I INMODE L +^DIZ(4001.1,INDA):INTIME Q $T
  1. L -^DIZ(4001.1,INDA)
  1. Q 1
  1. ;
  1. ;
  1. RESOLV(INIEN) ; Resolve transaction and errors associated with it
  1. ;
  1. ; Description: The function RESOLV is used to set interface transac-
  1. ; tions to a status of "COMPLETE". It will update all
  1. ; pointers and cross-references within the interface
  1. ; files, and update the status to RESOLVED on errors
  1. ; linked to these transaction.
  1. ; Return: Each entry will be set to a status value:
  1. ; 0^error text
  1. ; 1^ien value
  1. ;
  1. ; Parameters:
  1. ; INIEN = Array of entry numbers.
  1. ;
  1. ; Code begins:
  1. N INUIF,INSTAT
  1. ; loop thru array
  1. S INUIF=0 F S INUIF=$O(INIEN(INUIF)) Q:'INUIF D L -^INTHU(INUIF)
  1. . I '$D(^INTHU(INUIF,0)) S INIEN(INUIF)="0^Entry does not exist" Q
  1. . ;validate status of UIF entry
  1. . S INSTAT=$P($G(^INTHU(INUIF,0)),U,3)
  1. . I "^C^K^E"'[("^"_INSTAT) S INIEN(INUIF)="0^Status not COMPLETE, ERROR, or NEG ACK" Q
  1. . L +^INTHU(INUIF):0 E S INIEN(INUIF)="0^Cannot lock entry" Q
  1. . ; mark complete and update log, resolve all errors
  1. . D ULOG^INHU(INUIF,"C","Marked complete by user "_$P(^DIC(3,DUZ,0),U)_" through API")
  1. . S INIEN(INUIF)="1^"_INUIF
  1. Q
  1. ;