| 1 | ONCSED03 ;Hines OIFO/SG - EDITS 'RUN BATCH' (REPORT)  ; 2/14/07 10:21am | 
|---|
| 2 | ;;2.11;ONCOLOGY;**47**;Mar 07, 1995;Build 19 | 
|---|
| 3 | ; | 
|---|
| 4 | Q | 
|---|
| 5 | ; | 
|---|
| 6 | ;***** PRINTS ADDITIONAL EDIT INFO | 
|---|
| 7 | ; | 
|---|
| 8 | ; EDIEN         Internal number of the edit in the list of parsed | 
|---|
| 9 | ;               error messages generated by the RBQEXEC^ONCSED0101 | 
|---|
| 10 | ; | 
|---|
| 11 | EDINFO(EDIEN) ; | 
|---|
| 12 | N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EDTNDX,ESIEN,ESNAME,I,NODE,RC,SL,TMP,X,Y | 
|---|
| 13 | S RC=0 | 
|---|
| 14 | S ESIEN=+$G(@ONC8MSG@("ES",EDIEN))                  Q:ESIEN'>0 | 
|---|
| 15 | S ESNAME=$G(@ONC8MSG@(ESIEN,1))                     Q:ESNAME="" | 
|---|
| 16 | S EDTNDX=+$P($G(@ONC8MSG@(ESIEN,"E",EDIEN,0)),U,3)  Q:EDTNDX<0 | 
|---|
| 17 | S SL=$$REPEAT^XLFSTR("- ",$G(IOM,80)\2-1) | 
|---|
| 18 | ;--- Header | 
|---|
| 19 | S $Y=0  W @IOF,SL | 
|---|
| 20 | W !,"Additional info on '"_$G(@ONC8MSG@(ESIEN,"E",EDIEN,1))_"'" | 
|---|
| 21 | W !,SL | 
|---|
| 22 | ;--- Description | 
|---|
| 23 | S NODE=$$GETEDESC^ONCSED04(.ONCSAPI,ESNAME,EDTNDX) | 
|---|
| 24 | I NODE'<0  W !  D  Q:RC | 
|---|
| 25 | . S I=0 | 
|---|
| 26 | . F  S I=$O(@NODE@(I))  Q:I'>0  D  Q:RC | 
|---|
| 27 | . . W !,@NODE@(I)  S RC=$$PAGE1() | 
|---|
| 28 | ;--- Help | 
|---|
| 29 | S NODE=$$GETEDHLP^ONCSED04(.ONCSAPI,ESNAME,EDTNDX) | 
|---|
| 30 | I NODE'<0  W !  D  Q:RC | 
|---|
| 31 | . S I=0 | 
|---|
| 32 | . F  S I=$O(@NODE@(I))  Q:I'>0  D  Q:RC | 
|---|
| 33 | . . W !,@NODE@(I)  S RC=$$PAGE1() | 
|---|
| 34 | ;--- Trailer | 
|---|
| 35 | W !,SL | 
|---|
| 36 | S RC=$$PAGE1(,1) | 
|---|
| 37 | Q | 
|---|
| 38 | ; | 
|---|
| 39 | ;***** PRINTS THE MESSAGES | 
|---|
| 40 | ; | 
|---|
| 41 | ; [.ONCSAPI]    Reference to the API descriptor (see ^ONCSAPI) | 
|---|
| 42 | ; | 
|---|
| 43 | ; ONC8MSG       Closed root of the list of parsed error messages | 
|---|
| 44 | ;               (generated by the RBQEXEC^ONCSED0101) | 
|---|
| 45 | ; | 
|---|
| 46 | ; [FLAGS]       Flags that control the output | 
|---|
| 47 | ; | 
|---|
| 48 | ; Return values: | 
|---|
| 49 | ; | 
|---|
| 50 | ;       <0  Error Descriptor (see ^ONCSAPI for details) | 
|---|
| 51 | ;        0  Ok | 
|---|
| 52 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 53 | ;        2  Timeout | 
|---|
| 54 | ; | 
|---|
| 55 | MESSAGES(ONCSAPI,ONC8MSG,FLAGS) ; | 
|---|
| 56 | N ONCMNL        ; Maximum number of lines per page | 
|---|
| 57 | N ONCPAGE       ; Pointers to the beginning of the current page | 
|---|
| 58 | N ONCESIEN      ; Internal number of the current edit set | 
|---|
| 59 | N ONCEDIEN      ; Internal number of the current edit | 
|---|
| 60 | ; | 
|---|
| 61 | N EDTNDX,ESNAME,IEN,NODE,RC,REPRINT,TMP | 
|---|
| 62 | S RC=0,REPRINT=1,ONCMNL=$S($G(IOSL)>10:+IOSL,1:24) | 
|---|
| 63 | ;=== Set the pointers to the beginning of the list | 
|---|
| 64 | S ONCESIEN=$O(@ONC8MSG@(0)),ONCEDIEN="" | 
|---|
| 65 | S ONCPAGE=ONCESIEN_U_ONCEDIEN | 
|---|
| 66 | ; | 
|---|
| 67 | ;=== Print the messages and process user input | 
|---|
| 68 | F  D  Q:RC!(ONCESIEN'>0) | 
|---|
| 69 | . F  Q:ONCESIEN'>0  D  Q:RC  S ONCESIEN=$O(@ONC8MSG@(ONCESIEN)),ONCEDIEN="" | 
|---|
| 70 | . . ;--- Edit set name | 
|---|
| 71 | . . S ESNAME=@ONC8MSG@(ONCESIEN,1) | 
|---|
| 72 | . . I ONCEDIEN'>0  D  Q:RC | 
|---|
| 73 | . . . I REPRINT  S REPRINT=0 | 
|---|
| 74 | . . . E  S RC=$$PAGE(3)  Q:RC  W !! | 
|---|
| 75 | . . . S TMP=ESNAME_" (Metafile Version: "_$P(@ONC8MSG@(0),U,4)_")" | 
|---|
| 76 | . . . W TMP,!,$$REPEAT^XLFSTR("-",$L(TMP)) | 
|---|
| 77 | . . . S ONCEDIEN=$O(@ONC8MSG@(ONCESIEN,"E",0)) | 
|---|
| 78 | . . ;--- | 
|---|
| 79 | . . F  Q:ONCEDIEN'>0  D  Q:RC  S ONCEDIEN=$O(@ONC8MSG@(ONCESIEN,"E",ONCEDIEN)) | 
|---|
| 80 | . . . ;--- Edit name | 
|---|
| 81 | . . . I REPRINT  S REPRINT=0 | 
|---|
| 82 | . . . E  S RC=$$PAGE(2)  Q:RC  W !! | 
|---|
| 83 | . . . W ?2,ONCEDIEN_". "_@ONC8MSG@(ONCESIEN,"E",ONCEDIEN,1) | 
|---|
| 84 | . . . S NODE=$NA(@ONC8MSG@(ONCESIEN,"E",ONCEDIEN)) | 
|---|
| 85 | . . . ;--- Messages generated by the edit | 
|---|
| 86 | . . . S IEN=0 | 
|---|
| 87 | . . . F  S IEN=$O(@NODE@("M",IEN))  Q:IEN'>0  D  Q:RC | 
|---|
| 88 | . . . . S RC=$$PRTMSG($P(@NODE@("M",IEN,0),U,2),@NODE@("M",IEN,1),5) | 
|---|
| 89 | . . . Q:RC | 
|---|
| 90 | . . . ;--- Fields validated by the edit | 
|---|
| 91 | . . . S IEN=0 | 
|---|
| 92 | . . . F  S IEN=$O(@NODE@("F",IEN))  Q:IEN'>0  D  Q:RC | 
|---|
| 93 | . . . . S TMP=$E(@NODE@("F",IEN,1),1,25)               ; Name | 
|---|
| 94 | . . . . S TMP=TMP_" ("_(+$P(@NODE@("F",IEN,0),U))_")"  ; Position | 
|---|
| 95 | . . . . S RC=$$PRTFLD(TMP,$G(@NODE@("F",IEN,2)),9,35) | 
|---|
| 96 | . ;--- Force the "end of page" prompt after the last | 
|---|
| 97 | . ;--- portion of the data | 
|---|
| 98 | . I 'RC,$E(IOST,1,2)="C-",ONCESIEN'>0,$P(ONCPAGE,U,3)  D | 
|---|
| 99 | . . S RC=$$PAGE(,1) | 
|---|
| 100 | . Q:+RC'=3 | 
|---|
| 101 | . ;--- Display the additional edit info | 
|---|
| 102 | . D EDINFO(+$P(RC,U,2)) | 
|---|
| 103 | . ;--- Initiate the current page re-print | 
|---|
| 104 | . W @IOF  S ($Y,RC)=0,REPRINT=1 | 
|---|
| 105 | . S ONCESIEN=$P(ONCPAGE,U),ONCEDIEN=$P(ONCPAGE,U,2) | 
|---|
| 106 | ; | 
|---|
| 107 | ;=== Cleanup | 
|---|
| 108 | K ^UTILITY($J,"W") | 
|---|
| 109 | Q RC | 
|---|
| 110 | ; | 
|---|
| 111 | ;***** CHECKS IS NEW PAGE OF MESSAGES SHOULD BE STARTED | 
|---|
| 112 | ; | 
|---|
| 113 | ; [RESERVE]     Number of additional reserved lines (0, by default). | 
|---|
| 114 | ;               If the current page does not have so many lines | 
|---|
| 115 | ;               available, a new page will be started. | 
|---|
| 116 | ; | 
|---|
| 117 | ; [FORCE]       Force the "end of page" prompt. | 
|---|
| 118 | ; | 
|---|
| 119 | ; Return values: | 
|---|
| 120 | ; | 
|---|
| 121 | ;        0  Ok | 
|---|
| 122 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 123 | ;        2  Timeout | 
|---|
| 124 | ;        3  Display the edit info | 
|---|
| 125 | ; | 
|---|
| 126 | PAGE(RESERVE,FORCE) ; | 
|---|
| 127 | N RC,TRM | 
|---|
| 128 | S RC=0,TRM=($E(IOST,1,2)="C-"),$P(ONCPAGE,U,3)=1 | 
|---|
| 129 | I ($Y'<(ONCMNL-$S(TRM:3,1:1)-$G(RESERVE)))!$G(FORCE)  D | 
|---|
| 130 | . I 'TRM  W @IOF  S $Y=0  Q | 
|---|
| 131 | . N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y | 
|---|
| 132 | . S DIR(0)="FAO^^K:X'?.N X" | 
|---|
| 133 | . S DIR("A")="RETURN to continue, '^' to exit, or Edit# for help:" | 
|---|
| 134 | . S DIR("?",1)="Press RETURN key to continue the output, enter '^'" | 
|---|
| 135 | . S DIR("?",2)="to stop it, or enter the number printed to the left" | 
|---|
| 136 | . S DIR("?",3)="of the edit name to get additional information about" | 
|---|
| 137 | . S DIR("?")="this edit." | 
|---|
| 138 | . W !  D ^DIR | 
|---|
| 139 | . S RC=$S($D(DUOUT):1,$D(DTOUT):2,1:0)  Q:RC | 
|---|
| 140 | . I X>0  S RC=3_U_(+X)  Q | 
|---|
| 141 | . S $Y=0  W ! | 
|---|
| 142 | . ;--- Mark the beginning of the new page | 
|---|
| 143 | . S ONCPAGE=ONCESIEN_U_ONCEDIEN | 
|---|
| 144 | Q RC | 
|---|
| 145 | ; | 
|---|
| 146 | ;***** CHECKS IS NEW PAGE OF THE EDIT INFO SHOULD BE STARTED | 
|---|
| 147 | ; | 
|---|
| 148 | ; [RESERVE]     Number of additional reserved lines (0, by default). | 
|---|
| 149 | ;               If the current page does not have so many lines | 
|---|
| 150 | ;               available, a new page will be started. | 
|---|
| 151 | ; | 
|---|
| 152 | ; [FORCE]       Force the prompt | 
|---|
| 153 | ; | 
|---|
| 154 | ; Return values: | 
|---|
| 155 | ; | 
|---|
| 156 | ;        0  Ok | 
|---|
| 157 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 158 | ;        2  Timeout | 
|---|
| 159 | ; | 
|---|
| 160 | PAGE1(RESERVE,FORCE) ; | 
|---|
| 161 | N RC,TRM | 
|---|
| 162 | S RC=0,TRM=($E(IOST,1,2)="C-") | 
|---|
| 163 | I ($Y'<(ONCMNL-$S(TRM:3,1:1)-$G(RESERVE)))!$G(FORCE)  D | 
|---|
| 164 | . I 'TRM  W @IOF  S $Y=0  Q | 
|---|
| 165 | . N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,I,X,Y | 
|---|
| 166 | . S DIR(0)="EA" | 
|---|
| 167 | . S DIR("A")="Enter RETURN to continue or '^' to return to messages:" | 
|---|
| 168 | . W !  D ^DIR | 
|---|
| 169 | . S RC=$S($D(DUOUT):1,$D(DTOUT):2,1:0) | 
|---|
| 170 | . I 'RC  S $Y=0  W ! | 
|---|
| 171 | Q RC | 
|---|
| 172 | ; | 
|---|
| 173 | ;***** PRINTS THE FIELD (INTERNAL) | 
|---|
| 174 | ; | 
|---|
| 175 | ; NAME          Field name | 
|---|
| 176 | ; X             Field value | 
|---|
| 177 | ; DIWL          Left margin for the output | 
|---|
| 178 | ; MNL           Maximum length of the field name | 
|---|
| 179 | ; | 
|---|
| 180 | ; Return values: | 
|---|
| 181 | ; | 
|---|
| 182 | ;        0  Ok | 
|---|
| 183 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 184 | ;        2  Timeout | 
|---|
| 185 | ; | 
|---|
| 186 | PRTFLD(NAME,X,DIWL,MNL) ; | 
|---|
| 187 | N DIWF,DIWR,I,L,RC,TMP | 
|---|
| 188 | S DIWF="|",L=MNL+3,DIWR=$G(IOM,80)-L-1 | 
|---|
| 189 | K ^UTILITY($J,"W") | 
|---|
| 190 | D ^DIWP | 
|---|
| 191 | ;--- Write the name and the first piece of the value | 
|---|
| 192 | S TMP=DIWL-1,L=L+TMP | 
|---|
| 193 | W !?TMP,$$LJ^XLFSTR(NAME,MNL)_" = "_$G(^UTILITY($J,"W",DIWL,1,0)) | 
|---|
| 194 | S RC=$$PAGE()  Q:RC RC | 
|---|
| 195 | ;--- Write remaining pieces of the value (if any) | 
|---|
| 196 | S I=1 | 
|---|
| 197 | F  S I=$O(^UTILITY($J,"W",DIWL,I))  Q:I'>0  D  Q:RC | 
|---|
| 198 | . W !?L,$G(^UTILITY($J,"W",DIWL,I,0)) | 
|---|
| 199 | . S RC=$$PAGE() | 
|---|
| 200 | Q RC | 
|---|
| 201 | ; | 
|---|
| 202 | ;***** PRINTS THE MESSAGE (INTERNAL) | 
|---|
| 203 | ; | 
|---|
| 204 | ; TYPE          Message type | 
|---|
| 205 | ; X             Message text | 
|---|
| 206 | ; DIWL          Left margin for the output | 
|---|
| 207 | ; | 
|---|
| 208 | ; Return values: | 
|---|
| 209 | ; | 
|---|
| 210 | ;        0  Ok | 
|---|
| 211 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 212 | ;        2  Timeout | 
|---|
| 213 | ; | 
|---|
| 214 | PRTMSG(TYPE,X,DIWL) ; | 
|---|
| 215 | N DIWF,DIWR,I,L,RC,TMP | 
|---|
| 216 | S DIWF="|",L=$L(TYPE)+1,DIWR=$G(IOM,80)-L-1 | 
|---|
| 217 | K ^UTILITY($J,"W") | 
|---|
| 218 | D ^DIWP | 
|---|
| 219 | ;--- Write the type and first piece of the name | 
|---|
| 220 | S TMP=DIWL-1,L=L+TMP | 
|---|
| 221 | W !?TMP,TYPE_":"_$G(^UTILITY($J,"W",DIWL,1,0)) | 
|---|
| 222 | S RC=$$PAGE()  Q:RC RC | 
|---|
| 223 | ;--- Write remaing pieces of the name (if any) | 
|---|
| 224 | S I=1 | 
|---|
| 225 | F  S I=$O(^UTILITY($J,"W",DIWL,I))  Q:I'>0  D  Q:RC | 
|---|
| 226 | . W !?L,$G(^UTILITY($J,"W",DIWL,I,0)) | 
|---|
| 227 | . S RC=$$PAGE() | 
|---|
| 228 | Q RC | 
|---|
| 229 | ; | 
|---|
| 230 | ;***** PRINTS THE TOTALS | 
|---|
| 231 | ; | 
|---|
| 232 | ; [.ONCSAPI]    Reference to the API descriptor (see ^ONCSAPI) | 
|---|
| 233 | ; | 
|---|
| 234 | ; ONC8MSG       Closed root of the list of parsed error messages | 
|---|
| 235 | ;               (generated by the RBQEXEC^ONCSED0101) | 
|---|
| 236 | ; | 
|---|
| 237 | ; [FLAGS]       Flags that control the output | 
|---|
| 238 | ; | 
|---|
| 239 | ; Return values: | 
|---|
| 240 | ; | 
|---|
| 241 | ;       <0  Error Descriptor (see ^ONCSAPI for details) | 
|---|
| 242 | ;        0  Ok | 
|---|
| 243 | ;        1  User canceled the output ('^' was entered) | 
|---|
| 244 | ;        2  Timeout | 
|---|
| 245 | ; | 
|---|
| 246 | TOTALS(ONCSAPI,ONC8MSG,FLAGS) ; | 
|---|
| 247 | N EDIEN,ESIEN,IEN,ONCMNL,RC,TMP | 
|---|
| 248 | S RC=0,ONCMNL=$S($G(IOSL)>10:+IOSL,1:20) | 
|---|
| 249 | ;--- Header | 
|---|
| 250 | S RC=$$PAGE(3)  Q:RC RC | 
|---|
| 251 | W !!,$$LJ^XLFSTR("Edit Set","50T")_"  Errors  Warnings" | 
|---|
| 252 | W !,$$REPEAT^XLFSTR("-",50)_"  ------  --------" | 
|---|
| 253 | ;--- Edit set totals | 
|---|
| 254 | S ESIEN=0 | 
|---|
| 255 | F  S ESIEN=$O(@ONC8MSG@(ESIEN))  Q:ESIEN'>0  D  Q:RC | 
|---|
| 256 | . W !,$$LJ^XLFSTR(@ONC8MSG@(ESIEN,1),"50T") | 
|---|
| 257 | . S TMP=$G(@ONC8MSG@(ESIEN,0)) | 
|---|
| 258 | . W "  "_$J($P(TMP,U,1),6)_"  "_$J($P(TMP,U,2),8) | 
|---|
| 259 | . S RC=$$PAGE()  Q:RC | 
|---|
| 260 | Q RC | 
|---|