261 lines
7.9 KiB
Mathematica
261 lines
7.9 KiB
Mathematica
ONCSED03 ;Hines OIFO/SG - EDITS 'RUN BATCH' (REPORT) ; 2/14/07 10:21am
|
|
;;2.11;ONCOLOGY;**47**;Mar 07, 1995;Build 19
|
|
;
|
|
Q
|
|
;
|
|
;***** PRINTS ADDITIONAL EDIT INFO
|
|
;
|
|
; EDIEN Internal number of the edit in the list of parsed
|
|
; error messages generated by the RBQEXEC^ONCSED0101
|
|
;
|
|
EDINFO(EDIEN) ;
|
|
N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EDTNDX,ESIEN,ESNAME,I,NODE,RC,SL,TMP,X,Y
|
|
S RC=0
|
|
S ESIEN=+$G(@ONC8MSG@("ES",EDIEN)) Q:ESIEN'>0
|
|
S ESNAME=$G(@ONC8MSG@(ESIEN,1)) Q:ESNAME=""
|
|
S EDTNDX=+$P($G(@ONC8MSG@(ESIEN,"E",EDIEN,0)),U,3) Q:EDTNDX<0
|
|
S SL=$$REPEAT^XLFSTR("- ",$G(IOM,80)\2-1)
|
|
;--- Header
|
|
S $Y=0 W @IOF,SL
|
|
W !,"Additional info on '"_$G(@ONC8MSG@(ESIEN,"E",EDIEN,1))_"'"
|
|
W !,SL
|
|
;--- Description
|
|
S NODE=$$GETEDESC^ONCSED04(.ONCSAPI,ESNAME,EDTNDX)
|
|
I NODE'<0 W ! D Q:RC
|
|
. S I=0
|
|
. F S I=$O(@NODE@(I)) Q:I'>0 D Q:RC
|
|
. . W !,@NODE@(I) S RC=$$PAGE1()
|
|
;--- Help
|
|
S NODE=$$GETEDHLP^ONCSED04(.ONCSAPI,ESNAME,EDTNDX)
|
|
I NODE'<0 W ! D Q:RC
|
|
. S I=0
|
|
. F S I=$O(@NODE@(I)) Q:I'>0 D Q:RC
|
|
. . W !,@NODE@(I) S RC=$$PAGE1()
|
|
;--- Trailer
|
|
W !,SL
|
|
S RC=$$PAGE1(,1)
|
|
Q
|
|
;
|
|
;***** PRINTS THE MESSAGES
|
|
;
|
|
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
|
|
;
|
|
; ONC8MSG Closed root of the list of parsed error messages
|
|
; (generated by the RBQEXEC^ONCSED0101)
|
|
;
|
|
; [FLAGS] Flags that control the output
|
|
;
|
|
; Return values:
|
|
;
|
|
; <0 Error Descriptor (see ^ONCSAPI for details)
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
;
|
|
MESSAGES(ONCSAPI,ONC8MSG,FLAGS) ;
|
|
N ONCMNL ; Maximum number of lines per page
|
|
N ONCPAGE ; Pointers to the beginning of the current page
|
|
N ONCESIEN ; Internal number of the current edit set
|
|
N ONCEDIEN ; Internal number of the current edit
|
|
;
|
|
N EDTNDX,ESNAME,IEN,NODE,RC,REPRINT,TMP
|
|
S RC=0,REPRINT=1,ONCMNL=$S($G(IOSL)>10:+IOSL,1:24)
|
|
;=== Set the pointers to the beginning of the list
|
|
S ONCESIEN=$O(@ONC8MSG@(0)),ONCEDIEN=""
|
|
S ONCPAGE=ONCESIEN_U_ONCEDIEN
|
|
;
|
|
;=== Print the messages and process user input
|
|
F D Q:RC!(ONCESIEN'>0)
|
|
. F Q:ONCESIEN'>0 D Q:RC S ONCESIEN=$O(@ONC8MSG@(ONCESIEN)),ONCEDIEN=""
|
|
. . ;--- Edit set name
|
|
. . S ESNAME=@ONC8MSG@(ONCESIEN,1)
|
|
. . I ONCEDIEN'>0 D Q:RC
|
|
. . . I REPRINT S REPRINT=0
|
|
. . . E S RC=$$PAGE(3) Q:RC W !!
|
|
. . . S TMP=ESNAME_" (Metafile Version: "_$P(@ONC8MSG@(0),U,4)_")"
|
|
. . . W TMP,!,$$REPEAT^XLFSTR("-",$L(TMP))
|
|
. . . S ONCEDIEN=$O(@ONC8MSG@(ONCESIEN,"E",0))
|
|
. . ;---
|
|
. . F Q:ONCEDIEN'>0 D Q:RC S ONCEDIEN=$O(@ONC8MSG@(ONCESIEN,"E",ONCEDIEN))
|
|
. . . ;--- Edit name
|
|
. . . I REPRINT S REPRINT=0
|
|
. . . E S RC=$$PAGE(2) Q:RC W !!
|
|
. . . W ?2,ONCEDIEN_". "_@ONC8MSG@(ONCESIEN,"E",ONCEDIEN,1)
|
|
. . . S NODE=$NA(@ONC8MSG@(ONCESIEN,"E",ONCEDIEN))
|
|
. . . ;--- Messages generated by the edit
|
|
. . . S IEN=0
|
|
. . . F S IEN=$O(@NODE@("M",IEN)) Q:IEN'>0 D Q:RC
|
|
. . . . S RC=$$PRTMSG($P(@NODE@("M",IEN,0),U,2),@NODE@("M",IEN,1),5)
|
|
. . . Q:RC
|
|
. . . ;--- Fields validated by the edit
|
|
. . . S IEN=0
|
|
. . . F S IEN=$O(@NODE@("F",IEN)) Q:IEN'>0 D Q:RC
|
|
. . . . S TMP=$E(@NODE@("F",IEN,1),1,25) ; Name
|
|
. . . . S TMP=TMP_" ("_(+$P(@NODE@("F",IEN,0),U))_")" ; Position
|
|
. . . . S RC=$$PRTFLD(TMP,$G(@NODE@("F",IEN,2)),9,35)
|
|
. ;--- Force the "end of page" prompt after the last
|
|
. ;--- portion of the data
|
|
. I 'RC,$E(IOST,1,2)="C-",ONCESIEN'>0,$P(ONCPAGE,U,3) D
|
|
. . S RC=$$PAGE(,1)
|
|
. Q:+RC'=3
|
|
. ;--- Display the additional edit info
|
|
. D EDINFO(+$P(RC,U,2))
|
|
. ;--- Initiate the current page re-print
|
|
. W @IOF S ($Y,RC)=0,REPRINT=1
|
|
. S ONCESIEN=$P(ONCPAGE,U),ONCEDIEN=$P(ONCPAGE,U,2)
|
|
;
|
|
;=== Cleanup
|
|
K ^UTILITY($J,"W")
|
|
Q RC
|
|
;
|
|
;***** CHECKS IS NEW PAGE OF MESSAGES SHOULD BE STARTED
|
|
;
|
|
; [RESERVE] Number of additional reserved lines (0, by default).
|
|
; If the current page does not have so many lines
|
|
; available, a new page will be started.
|
|
;
|
|
; [FORCE] Force the "end of page" prompt.
|
|
;
|
|
; Return values:
|
|
;
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
; 3 Display the edit info
|
|
;
|
|
PAGE(RESERVE,FORCE) ;
|
|
N RC,TRM
|
|
S RC=0,TRM=($E(IOST,1,2)="C-"),$P(ONCPAGE,U,3)=1
|
|
I ($Y'<(ONCMNL-$S(TRM:3,1:1)-$G(RESERVE)))!$G(FORCE) D
|
|
. I 'TRM W @IOF S $Y=0 Q
|
|
. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
|
|
. S DIR(0)="FAO^^K:X'?.N X"
|
|
. S DIR("A")="RETURN to continue, '^' to exit, or Edit# for help:"
|
|
. S DIR("?",1)="Press RETURN key to continue the output, enter '^'"
|
|
. S DIR("?",2)="to stop it, or enter the number printed to the left"
|
|
. S DIR("?",3)="of the edit name to get additional information about"
|
|
. S DIR("?")="this edit."
|
|
. W ! D ^DIR
|
|
. S RC=$S($D(DUOUT):1,$D(DTOUT):2,1:0) Q:RC
|
|
. I X>0 S RC=3_U_(+X) Q
|
|
. S $Y=0 W !
|
|
. ;--- Mark the beginning of the new page
|
|
. S ONCPAGE=ONCESIEN_U_ONCEDIEN
|
|
Q RC
|
|
;
|
|
;***** CHECKS IS NEW PAGE OF THE EDIT INFO SHOULD BE STARTED
|
|
;
|
|
; [RESERVE] Number of additional reserved lines (0, by default).
|
|
; If the current page does not have so many lines
|
|
; available, a new page will be started.
|
|
;
|
|
; [FORCE] Force the prompt
|
|
;
|
|
; Return values:
|
|
;
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
;
|
|
PAGE1(RESERVE,FORCE) ;
|
|
N RC,TRM
|
|
S RC=0,TRM=($E(IOST,1,2)="C-")
|
|
I ($Y'<(ONCMNL-$S(TRM:3,1:1)-$G(RESERVE)))!$G(FORCE) D
|
|
. I 'TRM W @IOF S $Y=0 Q
|
|
. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,X,Y
|
|
. S DIR(0)="EA"
|
|
. S DIR("A")="Enter RETURN to continue or '^' to return to messages:"
|
|
. W ! D ^DIR
|
|
. S RC=$S($D(DUOUT):1,$D(DTOUT):2,1:0)
|
|
. I 'RC S $Y=0 W !
|
|
Q RC
|
|
;
|
|
;***** PRINTS THE FIELD (INTERNAL)
|
|
;
|
|
; NAME Field name
|
|
; X Field value
|
|
; DIWL Left margin for the output
|
|
; MNL Maximum length of the field name
|
|
;
|
|
; Return values:
|
|
;
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
;
|
|
PRTFLD(NAME,X,DIWL,MNL) ;
|
|
N DIWF,DIWR,I,L,RC,TMP
|
|
S DIWF="|",L=MNL+3,DIWR=$G(IOM,80)-L-1
|
|
K ^UTILITY($J,"W")
|
|
D ^DIWP
|
|
;--- Write the name and the first piece of the value
|
|
S TMP=DIWL-1,L=L+TMP
|
|
W !?TMP,$$LJ^XLFSTR(NAME,MNL)_" = "_$G(^UTILITY($J,"W",DIWL,1,0))
|
|
S RC=$$PAGE() Q:RC RC
|
|
;--- Write remaining pieces of the value (if any)
|
|
S I=1
|
|
F S I=$O(^UTILITY($J,"W",DIWL,I)) Q:I'>0 D Q:RC
|
|
. W !?L,$G(^UTILITY($J,"W",DIWL,I,0))
|
|
. S RC=$$PAGE()
|
|
Q RC
|
|
;
|
|
;***** PRINTS THE MESSAGE (INTERNAL)
|
|
;
|
|
; TYPE Message type
|
|
; X Message text
|
|
; DIWL Left margin for the output
|
|
;
|
|
; Return values:
|
|
;
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
;
|
|
PRTMSG(TYPE,X,DIWL) ;
|
|
N DIWF,DIWR,I,L,RC,TMP
|
|
S DIWF="|",L=$L(TYPE)+1,DIWR=$G(IOM,80)-L-1
|
|
K ^UTILITY($J,"W")
|
|
D ^DIWP
|
|
;--- Write the type and first piece of the name
|
|
S TMP=DIWL-1,L=L+TMP
|
|
W !?TMP,TYPE_":"_$G(^UTILITY($J,"W",DIWL,1,0))
|
|
S RC=$$PAGE() Q:RC RC
|
|
;--- Write remaing pieces of the name (if any)
|
|
S I=1
|
|
F S I=$O(^UTILITY($J,"W",DIWL,I)) Q:I'>0 D Q:RC
|
|
. W !?L,$G(^UTILITY($J,"W",DIWL,I,0))
|
|
. S RC=$$PAGE()
|
|
Q RC
|
|
;
|
|
;***** PRINTS THE TOTALS
|
|
;
|
|
; [.ONCSAPI] Reference to the API descriptor (see ^ONCSAPI)
|
|
;
|
|
; ONC8MSG Closed root of the list of parsed error messages
|
|
; (generated by the RBQEXEC^ONCSED0101)
|
|
;
|
|
; [FLAGS] Flags that control the output
|
|
;
|
|
; Return values:
|
|
;
|
|
; <0 Error Descriptor (see ^ONCSAPI for details)
|
|
; 0 Ok
|
|
; 1 User canceled the output ('^' was entered)
|
|
; 2 Timeout
|
|
;
|
|
TOTALS(ONCSAPI,ONC8MSG,FLAGS) ;
|
|
N EDIEN,ESIEN,IEN,ONCMNL,RC,TMP
|
|
S RC=0,ONCMNL=$S($G(IOSL)>10:+IOSL,1:20)
|
|
;--- Header
|
|
S RC=$$PAGE(3) Q:RC RC
|
|
W !!,$$LJ^XLFSTR("Edit Set","50T")_" Errors Warnings"
|
|
W !,$$REPEAT^XLFSTR("-",50)_" ------ --------"
|
|
;--- Edit set totals
|
|
S ESIEN=0
|
|
F S ESIEN=$O(@ONC8MSG@(ESIEN)) Q:ESIEN'>0 D Q:RC
|
|
. W !,$$LJ^XLFSTR(@ONC8MSG@(ESIEN,1),"50T")
|
|
. S TMP=$G(@ONC8MSG@(ESIEN,0))
|
|
. W " "_$J($P(TMP,U,1),6)_" "_$J($P(TMP,U,2),8)
|
|
. S RC=$$PAGE() Q:RC
|
|
Q RC
|