- HLDIEDB1 ;CIOFO-O/LJA - DEBUG Menu ;1/8/04 @ 01:28
- ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
- ;
- INIT ;
- N A7UMENU,A7UOK,A7UOPT,NOMENU,I,T,X,Y
- ;
- CTRL ;
- D HEADER
- D M
- D ASK I 'A7UOK QUIT ;->
- D XEC
- D BT QUIT:'A7UOK ;->
- G CTRL ;->
- ;
- BT ;
- N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
- W !
- S A7UOK=0
- N DIR
- S DIR(0)="EA",DIR("A")="Press RETURN to continue, or '^' to exit... "
- D ^DIR
- QUIT:+Y'=1 ;->
- S A7UOK=1
- QUIT
- ;
- N DEBUG,IOINHI,IOINORM,X
- W @IOF,$$CJ^XLFSTR("HLDIE Debug Utility",IOM)
- S DEBUG=$G(^XTMP("HLDIE-DEBUG","STATUS"))
- I DEBUG]"" D ; Show debug string...
- . S X="IOINORM;IOINHI" D ENDR^%ZISS
- . S DEBUG="Pre-call: "_$$CD($P(DEBUG,U))_" Post-call: "_$$CD($P(DEBUG,U,2))_" Screen: "_$$CD($P(DEBUG,U,3))
- . W !,?17,DEBUG
- W !,$$REPEAT^XLFSTR("=",80)
- QUIT
- ;
- CD(TXT) ; debug information
- ; IOINORM,IOINHI -- req
- QUIT:TXT']"" "OFF" ;->
- QUIT IOINHI_"ON["_TXT_"]"_IOINORM ;->
- ;
- M KILL A7UMENU N I,T F I=1:1 S T=$T(M+I) QUIT:T'[";;" S T=$P(T,";;",2,99),A7UMENU(I)=$P(T,"~",2,99) W !,$J(I,2),". ",$P(T,"~") S NOMENU=I
- ;;Display debug documentation~D DOC
- ;;Display debug data - API~D API^HLDIEDB0
- ;;Display debug data - FILE,IEN~D FILEIEN^HLDIEDB0
- ;;Display debug data - SEARCH~D SEARCH^HLDIEDB0
- ;;Display debug data - REALTIME~D REALTIME^HLDIEDB1
- ;;Display debug data - JOB~D JOB^HLDIEDB3
- ;;Set debug control string (Turn debugging on/off)~D SETDEBUG^HLDIEDBG
- ;;Kill debug data~D KILLALL^HLDIEDBG
- QUIT
- ;
- ASK ;
- ; NOMENU -- req
- N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
- W !
- S A7UOK=0
- N DIR
- S DIR(0)="NO^1:"_NOMENU,DIR("A")="Select option"
- D ^DIR
- QUIT:'$D(A7UMENU(+Y)) ;->
- S A7UOPT=+Y
- S A7UOK=1
- QUIT
- ;
- XEC ;
- S X=A7UMENU(+A7UOPT) X X
- QUIT
- ;
- REALTIME ; real-time monitoring...
- N C2,C3,C4,C5,C6,C7,C8,CT,GBL,LAST,STOP,X
- ;
- S GBL="^XTMP(""HLDIE-DEBUGN"",""N"")",LAST=$G(@GBL)
- S C2=7,C3=18,C4=30,C5=40,C6=52,C7=70,C8=75
- ;
- S CT=0
- ;
- D REALHDR
- ;
- F D Q:STOP
- . S STOP=1,CT=CT+1
- . D REALSHOW
- . R X:60 QUIT:X]"" ;->
- . S STOP=0
- ;
- Q
- ;
- REALHDR ; Header for real-time display...
- ; Cn -- req
- W !!,"#",?C2,"NOW",?C3,"File [#IEN]",?C4,"DataTM",?C5,"$J"
- W ?C6,"Rtn",?C7,"LOC",?C8,"Edtor"
- W !,$$REPEAT^XLFSTR("=",IOM)
- Q
- ;
- REALSHOW ; Show information...
- ;C2,C3,GBL,LAST -- req --> LAST
- N DNO,NOW,NUM
- ;
- S NUM=$G(@GBL),NOW=$$TIME($$NOW^XLFDT)
- ;
- I CT=1 D QUIT ;->
- . W !,?C2,NOW,?C3,"Collecting data..."
- ;
- I NUM=LAST D QUIT ;->
- . W:$X>0 !
- . W ?C2,NOW,?C3,"[No change]"
- ;
- F DNO=(LAST+1):1:NUM D REALONE(DNO)
- ;
- S LAST=NUM
- ;
- Q
- ;
- REALONE(DNO) ; Show one entry...
- ; Cn -- req
- N DATA,DATE,EDITOR,FILE,IEN,JOB,LOC,RTN,SNO,TIME
- ;
- S DATA=$G(@GBL@(DNO))
- S FILE=$P(DATA,U),IEN=$P(DATA,U,2),TIME=$P(DATA,U,3),JOB=$P(DATA,U,4)
- S RTN=$P(DATA,U,5),SNO=$P(DATA,U,6),EDITOR=$P(DATA,U,7)
- ;
- S TIME=$$TIME(TIME)
- ;
- W !,$J(DNO,5),?C2,NOW,?C3,FILE," [#",IEN,"]",?C4,TIME,?C5,JOB
- W ?C6,RTN,?C7,SNO,?C8,$S(EDITOR["HLDIE":"HL",1:"FM")
- ;
- Q
- ;
- TIME(FMTIME) ; Return HH:MM:SS
- S FMTIME=$P(FMTIME_"000000",".",2)
- QUIT $E(FMTIME,1,2)_":"_$E(FMTIME,3,4)_":"_$E(FMTIME,5,6)
- ;
- ;
- ;
- DOC N C,I,IOINHI,IOINORM,T,X
- S X="IOINHI;IOINORM" D ENDR^%ZISS
- F I=4:1 S T=$T(DOC+I) QUIT:T'[";;"!($G(X)[U) D
- . S T=$P(T,";;",2,99) S:$E(T,1,2)="[[" T=IOINHI_$TR(T,"[]","")_IOINORM W !,T
- ;;[[OVERVIEW]]
- ;; HLDIE debug data can be captured for evaluation by setting a "debug string."
- ;; The debug string is stored on the ^XTMP("HLDIE-DEBUG","STATUS") node.
- ;; This debug string should be set using the 'Set debug control string (Turn
- ;; debugging on/off)' menu choice.
- ;;
- ;;
- ;;[[DEBUG STRING DETAILS]]
- ;; The "debug string" had three(3) pieces:
- ;;
- ;; * Piece 1 controls data capture prior to FILE^DIE or FILE^HLDIE call.
- ;; - If set to 1, "select" data (see below) is captures.
- ;; - If set to 2, all local variables are captures.
- ;; - If set to "", no data is collected.
- ;;
- ;; * Piece 2 controls data capture after FILE^DIE or FILE^HLDIE call.
- ;; - See piece 1 above for setting details.
- ;;
- ;; * Piece 3 activates data capture screening.
- ;; - Piece 3 can be set to 1 to activate the data screen held in
- ;; $$STORESCR^HLDIEDB2. This API holds no M code, but is a placeholder
- ;; for M code that can evaluate the environment and on-the-fly turn on
- ;; or off data storage. (It can also control whethere "select" or all
- ;; data is captured.)
- ;;
- ;;
- ;;[[PIECE 3 DATA SCREEN DETAILS]]
- ;; If piece 3 of the debug control string equals 1, the following
- ;; occurs:
- ;;
- ;; * $$STORESCR^HLDIEDB2 is called by debugging process in FILE^HLDIE.
- ;; * The local variable STORE holds the value null, 1 or 2 (see above),
- ;; specifying whether data should be captured, and if so, whether "select"
- ;; or all local variables should be stored.
- ;; * If M code has been added to $$STORESCR^HLDIEDB2, it may evaluate the
- ;; environment and optionally reset STORE to null, 1 or 2.
- ;; * The value of STORE after M code execution is returned to the debugging
- ;; process. (And, if set to null, no data is captured.)
- ;;
- ;; The following variables are defined for use by the M code added to
- ;; $$STORESCR^HLDIEDB2:
- ;;
- ;; * CT - The number occurences already stored for TODAY/JOB#/API.
- ;; (When a job calls STATUS^HLTF0, a call is made to FILE^HLDIE which
- ;; can result in the creation of a debug data capture entry. Every
- ;; such call by the job to STATUS^HLTF0 results in the creation of
- ;; another data capture. Twenty such calls can be made, after which
- ;; the oldest capture is removed by the FIFO method. The value of CT
- ;; holds the total number of data capture occurences.)
- ;; * DEBUGNO - The sequential number to be used during data storage.
- ;; * DEBUGNOW - The date/time that will be used during data storage.
- ;; * HLFILE - The file being edited.
- ;; * HLIEN - The file's IEN being edited.
- ;; * LOC - 1 (before call) or 2 (after call).
- ;; * RTN - RTN~SUBRTN (from the 4th & 5th FILE^HLDIE parameters.)
- ;; * STORE - "" (don't store), 1 (store "select"), or 2 (store all.)
- ;;
- ;;
- ;;[[DEBUGGING - ALL VARIABLE STORAGE]]
- ;; Unrelated to the above debugging instructions, the
- ;; LOG^HLDIEDBG(SUBSV,KEEP,STOP) API can be used by VistA HL7 developers to
- ;; store all variables. (The DOLRO^%ZOSV API is used.) Data created by this
- ;; call is stored in:
- ;;
- ;; ^XTMP("HLDIE-"_DT,SUBSV,#,VAR)=VALUE
- ;;
- ;; Entries in this global are sequential at the '#' subscript level. When a
- ;; call is made to this API, all local variables are stored at the VAR
- ;; subscript level.
- ;;
- ;; The LOG API has the following parameters:
- ;;
- ;; * SUBSV - The subscript to be used when storing data. (The value of this
- ;; parameter is usually RTN~SUBRTN.)
- ;; * KEEP - The number of entries to store. (The entry of this parameter is
- ;; optional, defaulting to 20.)
- ;; * STOP - If set to 1, after KEEP number of entries are stored, no more
- ;; data is captured, (and no data is deleted.) If not set to 1,
- ;; KEEP number of entries are stored, the first entry stored is
- ;; deleted in FIFO manner, to ensure that no more than KEEP entries
- ;; exist.
- Q
- ;
- ERR ; If error occurs during screening...
- ; The SENDUZ(DUZ)="" array *MUST* already be defined...
- N C,DATA,ERRTXT,LP,NO,ST,STORERR,TEXT,TIME,X,XMDUZ,XMSUB,XMTEXT,XMZ
- ;
- ; Before continuing, specify that NOTHING should be stored...
- ; This email message is ALL that will be stored or sent.
- S STORE="" ; This variable is returned to FILE^HLDIE execution
- ;
- ; Also, turn off STORE capture!
- S ^XTMP("HLDIE-DEBUG","STATUS")=""
- ;
- ; Record an error in logger...
- S ERRTXT=$$EC^%ZOSV
- S X=$$LOG^HLEVAPI2("FILE-HLDIE","ERRTXT")
- ;
- ; setup things...
- S XMDUZ=.5,XMSUB="HLDIE $$STORESCR Error"
- S XMTEXT="^TMP("_$J_",""HLMSG"","
- KILL ^TMP($J,"HLMSG"),^TMP($J,"HLVAR")
- S NO=0
- ;
- ; Add text...
- D MAILADD("An error occurred in $$STORESCR^HLDIEDB2 that must be checked. The")
- D MAILADD("variables that existed at the time of the error are listed below.")
- D MAILADD("")
- D MAILADD("The error was '"_$$EC^%ZOSV_"'.")
- D MAILADD("")
- D MAILADD("IMPORTANT!! All debugging was turned off. Please review the problem,")
- D MAILADD(" then turn debugging back on.")
- D MAILADD("")
- D MAILADD("Local Variable List"),MAILADD("--------------------")
- ;
- S X="^TMP("_$J_",""HLVAR""," D DOLRO^%ZOSV
- S LP="^TMP("_$J_",""HLVAR""",ST=LP_",",LP=LP_")",C=","
- F S LP=$Q(@LP) Q:LP'[ST D
- . S DATA=$TR($P($P(LP,ST,2),")"),"""","")
- . I DATA[C S DATA=$P(DATA,C)_"("_$P(DATA,C,2,99)_")"
- . D MAILADD(DATA_"="_@LP)
- ;
- MERGE XMY=SENDUZ
- I $O(XMY(0))'>0 S XMY(+$G(DUZ))=""
- ;
- D ^XMD
- ;
- KILL ^TMP($J,"HLMSG"),^TMP($J,"HLVAR")
- ;
- D UNWIND^%ZTER
- ;
- Q
- ;
- MAILADD(T) S NO=$G(NO)+1,^TMP($J,"HLMSG",NO)=T
- QUIT
- ;
- EOR ;HLDIEDB1 - DEBUG Menu ;1/8/04 @ 01:28
- HLDIEDB1 ;CIOFO-O/LJA - DEBUG Menu ;1/8/04 @ 01:28
- +1 ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13,1995
- +2 ;
- INIT ;
- +1 NEW A7UMENU,A7UOK,A7UOPT,NOMENU,I,T,X,Y
- +2 ;
- CTRL ;
- +1 DO HEADER
- +2 DO M
- +3 ;->
- DO ASK
- IF 'A7UOK
- QUIT
- +4 DO XEC
- +5 ;->
- DO BT
- IF 'A7UOK
- QUIT
- +6 ;->
- GOTO CTRL
- +7 ;
- BT ;
- +1 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
- +2 WRITE !
- +3 SET A7UOK=0
- +4 NEW DIR
- +5 SET DIR(0)="EA"
- SET DIR("A")="Press RETURN to continue, or '^' to exit... "
- +6 DO ^DIR
- +7 ;->
- IF +Y'=1
- QUIT
- +8 SET A7UOK=1
- +9 QUIT
- +10 ;
- +1 NEW DEBUG,IOINHI,IOINORM,X
- +2 WRITE @IOF,$$CJ^XLFSTR("HLDIE Debug Utility",IOM)
- +3 SET DEBUG=$GET(^XTMP("HLDIE-DEBUG","STATUS"))
- +4 ; Show debug string...
- IF DEBUG]""
- Begin DoDot:1
- +5 SET X="IOINORM;IOINHI"
- DO ENDR^%ZISS
- +6 SET DEBUG="Pre-call: "_$$CD($PIECE(DEBUG,U))_" Post-call: "_$$CD($PIECE(DEBUG,U,2))_" Screen: "_$$CD($PIECE(DEBUG,U,3))
- +7 WRITE !,?17,DEBUG
- End DoDot:1
- +8 WRITE !,$$REPEAT^XLFSTR("=",80)
- +9 QUIT
- +10 ;
- CD(TXT) ; debug information
- +1 ; IOINORM,IOINHI -- req
- +2 ;->
- IF TXT']""
- QUIT "OFF"
- +3 ;->
- QUIT IOINHI_"ON["_TXT_"]"_IOINORM
- +4 ;
- M KILL A7UMENU
- NEW I,T
- FOR I=1:1
- SET T=$TEXT(M+I)
- IF T'[";;"
- QUIT
- SET T=$PIECE(T,";;",2,99)
- SET A7UMENU(I)=$PIECE(T,"~",2,99)
- WRITE !,$JUSTIFY(I,2),". ",$PIECE(T,"~")
- SET NOMENU=I
- +1 ;;Display debug documentation~D DOC
- +2 ;;Display debug data - API~D API^HLDIEDB0
- +3 ;;Display debug data - FILE,IEN~D FILEIEN^HLDIEDB0
- +4 ;;Display debug data - SEARCH~D SEARCH^HLDIEDB0
- +5 ;;Display debug data - REALTIME~D REALTIME^HLDIEDB1
- +6 ;;Display debug data - JOB~D JOB^HLDIEDB3
- +7 ;;Set debug control string (Turn debugging on/off)~D SETDEBUG^HLDIEDBG
- +8 ;;Kill debug data~D KILLALL^HLDIEDBG
- +9 QUIT
- +10 ;
- ASK ;
- +1 ; NOMENU -- req
- +2 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
- +3 WRITE !
- +4 SET A7UOK=0
- +5 NEW DIR
- +6 SET DIR(0)="NO^1:"_NOMENU
- SET DIR("A")="Select option"
- +7 DO ^DIR
- +8 ;->
- IF '$DATA(A7UMENU(+Y))
- QUIT
- +9 SET A7UOPT=+Y
- +10 SET A7UOK=1
- +11 QUIT
- +12 ;
- XEC ;
- +1 SET X=A7UMENU(+A7UOPT)
- XECUTE X
- +2 QUIT
- +3 ;
- REALTIME ; real-time monitoring...
- +1 NEW C2,C3,C4,C5,C6,C7,C8,CT,GBL,LAST,STOP,X
- +2 ;
- +3 SET GBL="^XTMP(""HLDIE-DEBUGN"",""N"")"
- SET LAST=$GET(@GBL)
- +4 SET C2=7
- SET C3=18
- SET C4=30
- SET C5=40
- SET C6=52
- SET C7=70
- SET C8=75
- +5 ;
- +6 SET CT=0
- +7 ;
- +8 DO REALHDR
- +9 ;
- +10 FOR
- Begin DoDot:1
- +11 SET STOP=1
- SET CT=CT+1
- +12 DO REALSHOW
- +13 ;->
- READ X:60
- IF X]""
- QUIT
- +14 SET STOP=0
- End DoDot:1
- IF STOP
- QUIT
- +15 ;
- +16 QUIT
- +17 ;
- REALHDR ; Header for real-time display...
- +1 ; Cn -- req
- +2 WRITE !!,"#",?C2,"NOW",?C3,"File [#IEN]",?C4,"DataTM",?C5,"$J"
- +3 WRITE ?C6,"Rtn",?C7,"LOC",?C8,"Edtor"
- +4 WRITE !,$$REPEAT^XLFSTR("=",IOM)
- +5 QUIT
- +6 ;
- REALSHOW ; Show information...
- +1 ;C2,C3,GBL,LAST -- req --> LAST
- +2 NEW DNO,NOW,NUM
- +3 ;
- +4 SET NUM=$GET(@GBL)
- SET NOW=$$TIME($$NOW^XLFDT)
- +5 ;
- +6 ;->
- IF CT=1
- Begin DoDot:1
- +7 WRITE !,?C2,NOW,?C3,"Collecting data..."
- End DoDot:1
- QUIT
- +8 ;
- +9 ;->
- IF NUM=LAST
- Begin DoDot:1
- +10 IF $X>0
- WRITE !
- +11 WRITE ?C2,NOW,?C3,"[No change]"
- End DoDot:1
- QUIT
- +12 ;
- +13 FOR DNO=(LAST+1):1:NUM
- DO REALONE(DNO)
- +14 ;
- +15 SET LAST=NUM
- +16 ;
- +17 QUIT
- +18 ;
- REALONE(DNO) ; Show one entry...
- +1 ; Cn -- req
- +2 NEW DATA,DATE,EDITOR,FILE,IEN,JOB,LOC,RTN,SNO,TIME
- +3 ;
- +4 SET DATA=$GET(@GBL@(DNO))
- +5 SET FILE=$PIECE(DATA,U)
- SET IEN=$PIECE(DATA,U,2)
- SET TIME=$PIECE(DATA,U,3)
- SET JOB=$PIECE(DATA,U,4)
- +6 SET RTN=$PIECE(DATA,U,5)
- SET SNO=$PIECE(DATA,U,6)
- SET EDITOR=$PIECE(DATA,U,7)
- +7 ;
- +8 SET TIME=$$TIME(TIME)
- +9 ;
- +10 WRITE !,$JUSTIFY(DNO,5),?C2,NOW,?C3,FILE," [#",IEN,"]",?C4,TIME,?C5,JOB
- +11 WRITE ?C6,RTN,?C7,SNO,?C8,$SELECT(EDITOR["HLDIE":"HL",1:"FM")
- +12 ;
- +13 QUIT
- +14 ;
- TIME(FMTIME) ; Return HH:MM:SS
- +1 SET FMTIME=$PIECE(FMTIME_"000000",".",2)
- +2 QUIT $EXTRACT(FMTIME,1,2)_":"_$EXTRACT(FMTIME,3,4)_":"_$EXTRACT(FMTIME,5,6)
- +3 ;
- +4 ;
- +5 ;
- DOC NEW C,I,IOINHI,IOINORM,T,X
- +1 SET X="IOINHI;IOINORM"
- DO ENDR^%ZISS
- +2 FOR I=4:1
- SET T=$TEXT(DOC+I)
- IF T'[";;"!($GET(X)[U)
- QUIT
- Begin DoDot:1
- +3 SET T=$PIECE(T,";;",2,99)
- IF $EXTRACT(T,1,2)="[["
- SET T=IOINHI_$TRANSLATE(T,"[]","")_IOINORM
- WRITE !,T
- End DoDot:1
- +4 ;;[[OVERVIEW]]
- +5 ;; HLDIE debug data can be captured for evaluation by setting a "debug string."
- +6 ;; The debug string is stored on the ^XTMP("HLDIE-DEBUG","STATUS") node.
- +7 ;; This debug string should be set using the 'Set debug control string (Turn
- +8 ;; debugging on/off)' menu choice.
- +9 ;;
- +10 ;;
- +11 ;;[[DEBUG STRING DETAILS]]
- +12 ;; The "debug string" had three(3) pieces:
- +13 ;;
- +14 ;; * Piece 1 controls data capture prior to FILE^DIE or FILE^HLDIE call.
- +15 ;; - If set to 1, "select" data (see below) is captures.
- +16 ;; - If set to 2, all local variables are captures.
- +17 ;; - If set to "", no data is collected.
- +18 ;;
- +19 ;; * Piece 2 controls data capture after FILE^DIE or FILE^HLDIE call.
- +20 ;; - See piece 1 above for setting details.
- +21 ;;
- +22 ;; * Piece 3 activates data capture screening.
- +23 ;; - Piece 3 can be set to 1 to activate the data screen held in
- +24 ;; $$STORESCR^HLDIEDB2. This API holds no M code, but is a placeholder
- +25 ;; for M code that can evaluate the environment and on-the-fly turn on
- +26 ;; or off data storage. (It can also control whethere "select" or all
- +27 ;; data is captured.)
- +28 ;;
- +29 ;;
- +30 ;;[[PIECE 3 DATA SCREEN DETAILS]]
- +31 ;; If piece 3 of the debug control string equals 1, the following
- +32 ;; occurs:
- +33 ;;
- +34 ;; * $$STORESCR^HLDIEDB2 is called by debugging process in FILE^HLDIE.
- +35 ;; * The local variable STORE holds the value null, 1 or 2 (see above),
- +36 ;; specifying whether data should be captured, and if so, whether "select"
- +37 ;; or all local variables should be stored.
- +38 ;; * If M code has been added to $$STORESCR^HLDIEDB2, it may evaluate the
- +39 ;; environment and optionally reset STORE to null, 1 or 2.
- +40 ;; * The value of STORE after M code execution is returned to the debugging
- +41 ;; process. (And, if set to null, no data is captured.)
- +42 ;;
- +43 ;; The following variables are defined for use by the M code added to
- +44 ;; $$STORESCR^HLDIEDB2:
- +45 ;;
- +46 ;; * CT - The number occurences already stored for TODAY/JOB#/API.
- +47 ;; (When a job calls STATUS^HLTF0, a call is made to FILE^HLDIE which
- +48 ;; can result in the creation of a debug data capture entry. Every
- +49 ;; such call by the job to STATUS^HLTF0 results in the creation of
- +50 ;; another data capture. Twenty such calls can be made, after which
- +51 ;; the oldest capture is removed by the FIFO method. The value of CT
- +52 ;; holds the total number of data capture occurences.)
- +53 ;; * DEBUGNO - The sequential number to be used during data storage.
- +54 ;; * DEBUGNOW - The date/time that will be used during data storage.
- +55 ;; * HLFILE - The file being edited.
- +56 ;; * HLIEN - The file's IEN being edited.
- +57 ;; * LOC - 1 (before call) or 2 (after call).
- +58 ;; * RTN - RTN~SUBRTN (from the 4th & 5th FILE^HLDIE parameters.)
- +59 ;; * STORE - "" (don't store), 1 (store "select"), or 2 (store all.)
- +60 ;;
- +61 ;;
- +62 ;;[[DEBUGGING - ALL VARIABLE STORAGE]]
- +63 ;; Unrelated to the above debugging instructions, the
- +64 ;; LOG^HLDIEDBG(SUBSV,KEEP,STOP) API can be used by VistA HL7 developers to
- +65 ;; store all variables. (The DOLRO^%ZOSV API is used.) Data created by this
- +66 ;; call is stored in:
- +67 ;;
- +68 ;; ^XTMP("HLDIE-"_DT,SUBSV,#,VAR)=VALUE
- +69 ;;
- +70 ;; Entries in this global are sequential at the '#' subscript level. When a
- +71 ;; call is made to this API, all local variables are stored at the VAR
- +72 ;; subscript level.
- +73 ;;
- +74 ;; The LOG API has the following parameters:
- +75 ;;
- +76 ;; * SUBSV - The subscript to be used when storing data. (The value of this
- +77 ;; parameter is usually RTN~SUBRTN.)
- +78 ;; * KEEP - The number of entries to store. (The entry of this parameter is
- +79 ;; optional, defaulting to 20.)
- +80 ;; * STOP - If set to 1, after KEEP number of entries are stored, no more
- +81 ;; data is captured, (and no data is deleted.) If not set to 1,
- +82 ;; KEEP number of entries are stored, the first entry stored is
- +83 ;; deleted in FIFO manner, to ensure that no more than KEEP entries
- +84 ;; exist.
- +85 QUIT
- +86 ;
- ERR ; If error occurs during screening...
- +1 ; The SENDUZ(DUZ)="" array *MUST* already be defined...
- +2 NEW C,DATA,ERRTXT,LP,NO,ST,STORERR,TEXT,TIME,X,XMDUZ,XMSUB,XMTEXT,XMZ
- +3 ;
- +4 ; Before continuing, specify that NOTHING should be stored...
- +5 ; This email message is ALL that will be stored or sent.
- +6 ; This variable is returned to FILE^HLDIE execution
- SET STORE=""
- +7 ;
- +8 ; Also, turn off STORE capture!
- +9 SET ^XTMP("HLDIE-DEBUG","STATUS")=""
- +10 ;
- +11 ; Record an error in logger...
- +12 SET ERRTXT=$$EC^%ZOSV
- +13 SET X=$$LOG^HLEVAPI2("FILE-HLDIE","ERRTXT")
- +14 ;
- +15 ; setup things...
- +16 SET XMDUZ=.5
- SET XMSUB="HLDIE $$STORESCR Error"
- +17 SET XMTEXT="^TMP("_$JOB_",""HLMSG"","
- +18 KILL ^TMP($JOB,"HLMSG"),^TMP($JOB,"HLVAR")
- +19 SET NO=0
- +20 ;
- +21 ; Add text...
- +22 DO MAILADD("An error occurred in $$STORESCR^HLDIEDB2 that must be checked. The")
- +23 DO MAILADD("variables that existed at the time of the error are listed below.")
- +24 DO MAILADD("")
- +25 DO MAILADD("The error was '"_$$EC^%ZOSV_"'.")
- +26 DO MAILADD("")
- +27 DO MAILADD("IMPORTANT!! All debugging was turned off. Please review the problem,")
- +28 DO MAILADD(" then turn debugging back on.")
- +29 DO MAILADD("")
- +30 DO MAILADD("Local Variable List")
- DO MAILADD("--------------------")
- +31 ;
- +32 SET X="^TMP("_$JOB_",""HLVAR"","
- DO DOLRO^%ZOSV
- +33 SET LP="^TMP("_$JOB_",""HLVAR"""
- SET ST=LP_","
- SET LP=LP_")"
- SET C=","
- +34 FOR
- SET LP=$QUERY(@LP)
- IF LP'[ST
- QUIT
- Begin DoDot:1
- +35 SET DATA=$TRANSLATE($PIECE($PIECE(LP,ST,2),")"),"""","")
- +36 IF DATA[C
- SET DATA=$PIECE(DATA,C)_"("_$PIECE(DATA,C,2,99)_")"
- +37 DO MAILADD(DATA_"="_@LP)
- End DoDot:1
- +38 ;
- +39 MERGE XMY=SENDUZ
- +40 IF $ORDER(XMY(0))'>0
- SET XMY(+$GET(DUZ))=""
- +41 ;
- +42 DO ^XMD
- +43 ;
- +44 KILL ^TMP($JOB,"HLMSG"),^TMP($JOB,"HLVAR")
- +45 ;
- +46 DO UNWIND^%ZTER
- +47 ;
- +48 QUIT
- +49 ;
- MAILADD(T) SET NO=$GET(NO)+1
- SET ^TMP($JOB,"HLMSG",NO)=T
- +1 QUIT
- +2 ;
- EOR ;HLDIEDB1 - DEBUG Menu ;1/8/04 @ 01:28