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

ONCSED03.m

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