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