HMPMONA ;ASMR/BL, eHMP monitor action prompts ;Sep 13, 2016 20:03:08
 ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2,3**;April 14,2016;Build 15
 ;Per VA Directive 6402, this routine should not be modified.
 ;
 Q  ; no entry from top
 ;DE6526, DE6644 - routine refactored, 25 August 2016
 ; this routine contains Action to support the calls to ^DIR
PROMPT(HMPACT,HMPROMPT) ; issues the action prompts throughout the eHMP Monitor
 ; Invoked by OPTION^HMPMON
 ; input:
 ;   HMPROMPT = MNTR or ERR or HIST or SYNC, default to MNTR
 ; output:
 ;  HMPACT - user-selected prompt, passed by reference
 ;
 S HMPROMPT=$G(HMPROMPT,"MNTR") ; default to monitor
 I $$PROMPTS^HMPMONR'[(U_HMPROMPT_U) D  Q  ; can't issue undefined prompt
 . W !!,"Invalid prompt default detected, cannot continue.",!
 . D RTRN2CON^HMPMONL
 ;
 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 S DIR(0)=$$CODES(HMPROMPT) ; set-of-codes
 S DIR("A")=$P(HMPCALLS(U,"DIR","text",HMPROMPT),";",2)  ; prompt text
 S X=$G(HMPMNTR("default")) S:$L(X) DIR("B")=X  ; prompt default
 S X=$G(HMPCALLS(U,"DIR","?",HMPROMPT))  ; extended ?? help specification
 S:$L(X) DIR("?")=X  ; only if help set up
 S DIR("T")=HMPRATE ; set timeout to control auto-refresh rate
 W !  ; skip a line for readability
 D ^DIR
 ;
 S:$D(DTOUT) Y=DIR("B")  ; for action prompts, timeout = default, creates auto-update
 I $D(DUOUT)!$D(DIROUT) Q  ; timeout or '^', exit
 S HMPACT=Y  ; action selected by user returned
 ;
 Q
 ;
CODES(HMPROMPT) ; prompt's set of codes to be used in ^DIR
 ; called by:
 ;   PROMPT
 ; calls:
 ;   $$PROMPTS^HMPMON = Monitor's main prompts
 ;   $T(@(HMPROMPT_"CODE")^HMPMON) ; prompt record's header line
 ;   $$CODE = code definition
 ; input:
 ;   HMPROMPT = MNTR or ERR or HIST or SYNC, default to MNTR
 ; output = set-of-codes definition for prompt
 ; examples:
 ;   $$CODES = "SB^U:Update;V:View HMP Nodes;S:Sync Processes;E:E..."
 ;   $$CODES("HIST") = "SB^UH:Update History;EH:Examine History;M..."
 ;   $$CODES("NONSENSE") = ""
 ;
 N C,CODES,X,Y
 S HMPROMPT=$G(HMPROMPT,"MNTR") ; default to monitor
 Q:$$PROMPTS^HMPMONR'[(U_HMPROMPT_U) "" ; undefined prompt return null
 ; go through list of ^DIR calls and set it up for this monitor screen
 S CODES="",C=0,X="" F  S X=$O(HMPCALLS(U,"DIR",HMPROMPT,X)) Q:X=""  D
 . S:$G(HMPCALLS(U,"DIR",HMPROMPT,X,"default")) HMPMNTR("default")=X
 . S Y=$G(HMPCALLS(X)) S:$L(Y) C=C+1,$P(CODES,";",C)=X_":"_$P(Y,";")
 ; S - is set of codes, B indicates horizontal list of prompts
 Q "SB^"_CODES
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHMPMONA   2547     printed  Sep 23, 2025@19:30:13                                                                                                                                                                                                     Page 2
HMPMONA   ;ASMR/BL, eHMP monitor action prompts ;Sep 13, 2016 20:03:08
 +1       ;;2.0;ENTERPRISE HEALTH MANAGEMENT PLATFORM;**2,3**;April 14,2016;Build 15
 +2       ;Per VA Directive 6402, this routine should not be modified.
 +3       ;
 +4       ; no entry from top
           QUIT 
 +5       ;DE6526, DE6644 - routine refactored, 25 August 2016
 +6       ; this routine contains Action to support the calls to ^DIR
PROMPT(HMPACT,HMPROMPT) ; issues the action prompts throughout the eHMP Monitor
 +1       ; Invoked by OPTION^HMPMON
 +2       ; input:
 +3       ;   HMPROMPT = MNTR or ERR or HIST or SYNC, default to MNTR
 +4       ; output:
 +5       ;  HMPACT - user-selected prompt, passed by reference
 +6       ;
 +7       ; default to monitor
           SET HMPROMPT=$GET(HMPROMPT,"MNTR")
 +8       ; can't issue undefined prompt
           IF $$PROMPTS^HMPMONR'[(U_HMPROMPT_U)
               Begin DoDot:1
 +9                WRITE !!,"Invalid prompt default detected, cannot continue.",!
 +10               DO RTRN2CON^HMPMONL
               End DoDot:1
               QUIT 
 +11      ;
 +12       NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
 +13      ; set-of-codes
           SET DIR(0)=$$CODES(HMPROMPT)
 +14      ; prompt text
           SET DIR("A")=$PIECE(HMPCALLS(U,"DIR","text",HMPROMPT),";",2)
 +15      ; prompt default
           SET X=$GET(HMPMNTR("default"))
           if $LENGTH(X)
               SET DIR("B")=X
 +16      ; extended ?? help specification
           SET X=$GET(HMPCALLS(U,"DIR","?",HMPROMPT))
 +17      ; only if help set up
           if $LENGTH(X)
               SET DIR("?")=X
 +18      ; set timeout to control auto-refresh rate
           SET DIR("T")=HMPRATE
 +19      ; skip a line for readability
           WRITE !
 +20       DO ^DIR
 +21      ;
 +22      ; for action prompts, timeout = default, creates auto-update
           if $DATA(DTOUT)
               SET Y=DIR("B")
 +23      ; timeout or '^', exit
           IF $DATA(DUOUT)!$DATA(DIROUT)
               QUIT 
 +24      ; action selected by user returned
           SET HMPACT=Y
 +25      ;
 +26       QUIT 
 +27      ;
CODES(HMPROMPT) ; prompt's set of codes to be used in ^DIR
 +1       ; called by:
 +2       ;   PROMPT
 +3       ; calls:
 +4       ;   $$PROMPTS^HMPMON = Monitor's main prompts
 +5       ;   $T(@(HMPROMPT_"CODE")^HMPMON) ; prompt record's header line
 +6       ;   $$CODE = code definition
 +7       ; input:
 +8       ;   HMPROMPT = MNTR or ERR or HIST or SYNC, default to MNTR
 +9       ; output = set-of-codes definition for prompt
 +10      ; examples:
 +11      ;   $$CODES = "SB^U:Update;V:View HMP Nodes;S:Sync Processes;E:E..."
 +12      ;   $$CODES("HIST") = "SB^UH:Update History;EH:Examine History;M..."
 +13      ;   $$CODES("NONSENSE") = ""
 +14      ;
 +15       NEW C,CODES,X,Y
 +16      ; default to monitor
           SET HMPROMPT=$GET(HMPROMPT,"MNTR")
 +17      ; undefined prompt return null
           if $$PROMPTS^HMPMONR'[(U_HMPROMPT_U)
               QUIT ""
 +18      ; go through list of ^DIR calls and set it up for this monitor screen
 +19       SET CODES=""
           SET C=0
           SET X=""
           FOR 
               SET X=$ORDER(HMPCALLS(U,"DIR",HMPROMPT,X))
               if X=""
                   QUIT 
               Begin DoDot:1
 +20               if $GET(HMPCALLS(U,"DIR",HMPROMPT,X,"default"))
                       SET HMPMNTR("default")=X
 +21               SET Y=$GET(HMPCALLS(X))
                   if $LENGTH(Y)
                       SET C=C+1
                       SET $PIECE(CODES,";",C)=X_":"_$PIECE(Y,";")
               End DoDot:1
 +22      ; S - is set of codes, B indicates horizontal list of prompts
 +23       QUIT "SB^"_CODES
 +24      ;