1 | SPNAHOC5 ;HISC/DAD-AD HOC REPORTS: MISCELLANEOUS ; [ 02/21/95 4:05 PM ]
|
---|
2 | ;;2.0;Spinal Cord Dysfunction;;01/02/1997
|
---|
3 | ;
|
---|
4 | MACCHK ; *** Check/update macro checksums
|
---|
5 | G:$$GET1^DID(+$G(SPNDIC),"","","NAME")=""!($G(SPNMRTN)="") EXIT
|
---|
6 | D SETUP G:(SPNMMAX'>0)!(SPNSORT'>0) EXIT
|
---|
7 | W !!,"Check/update macro checksums."
|
---|
8 | S (SPND0,SPNQUIT,SPNYESNO)=0
|
---|
9 | F S SPND0=$O(^SPNL(154.8,SPND0)) Q:SPND0'>0!SPNQUIT D
|
---|
10 | . S SP=$G(^SPNL(154.8,SPND0,0))
|
---|
11 | . S SPNMACRO=$P(SP,U),SPNTYPE=$P(SP,U,2)
|
---|
12 | . S SPNDIC(0)=$P(SP,U,3),SPNCHKSM(0)=$P(SP,U,4)
|
---|
13 | . I SPNDIC'=SPNDIC(0) Q
|
---|
14 | . W !!,"Macro: ",SPNMACRO
|
---|
15 | . W ?40,"Type: ",$S(SPNTYPE="s":"Sort",SPNTYPE="p":"Print",1:"???")
|
---|
16 | . W ?55,"Checksum: ",SPNCHKSM(0)
|
---|
17 | . I SPNCHKSM=SPNCHKSM(0) W !,"Checksum is OK." Q
|
---|
18 | . I SPNYESNO'=2 D
|
---|
19 | .. K DIR
|
---|
20 | .. S DIR(0)="SOAB^y:YES;n:NO;a:ALL;",DIR("?")="^D EN^SPNAHOCH(""H10"")"
|
---|
21 | .. S DIR("A")="Change checksum to "_SPNCHKSM_": ",DIR("B")="NO"
|
---|
22 | .. D ^DIR K DIR I $D(DIRUT) S SPNQUIT=1 Q
|
---|
23 | .. S SPNYESNO=$S(Y="a":2,Y="y":1,1:0)
|
---|
24 | .. Q
|
---|
25 | . K DA,DIE,DR S DIE="^SPNL(154.8,",DA=SPND0,DR=".04////"_SPNCHKSM
|
---|
26 | . I SPNYESNO D ^DIE
|
---|
27 | . Q
|
---|
28 | W:'SPNQUIT !!,"Done."
|
---|
29 | EXIT G EXIT^SPNAHOC0
|
---|
30 | ;
|
---|
31 | SETUP ; *** Set up needed variables
|
---|
32 | D XIT^SPNAHOC0,DT^DICRW,HOME^%ZIS,@SPNMRTN K SPNMENU(0)
|
---|
33 | S (SPNMMAX,SPNCHKSM,SPNSORT,SP)=0 F S SP=$O(SPNMENU(SP)) Q:SP'>0 D
|
---|
34 | . S SPNMMAX=SPNMMAX+1,SPNCHKSM(0)=0,X=SPNMENU(SP) S:X SPNSORT=SPNSORT+1
|
---|
35 | . F SPI=1:1:$L(X) S SPNCHKSM(0)=$A(X,SPI)*SPI+SPNCHKSM(0)
|
---|
36 | . S SPNCHKSM=SPNCHKSM(0)*SP+SPNCHKSM
|
---|
37 | . Q
|
---|
38 | S SPNBLURB="Enter numeric 1 to "_SPNMMAX_", <RETURN> to end, ^ to exit"
|
---|
39 | S SPNYESNO="Please answer Y(es) or N(o)." K BY,FLDS,FR,TO
|
---|
40 | S (SPNNUMOP("S"),SPNNUMOP("P"),SPNQUIT,SPNNEXT)=0,(BY,FLDS)=""
|
---|
41 | S SPNMAXOP("S")=4,SPNMAXOP("P")=7,SPNDTIME=10,$P(SPNUNDL,"_",81)=""
|
---|
42 | Q
|
---|
43 | ;
|
---|
44 | SETSAVE ; *** Set save flag
|
---|
45 | S SPNMSAVE=1 W !!?3,"The macro will be saved when you exit the "
|
---|
46 | W SPNTYPE(0)," menu. ",$C(7) I SPNSEQ=1 R SP:SPNDTIME Q
|
---|
47 | F W !!?3,"OK to exit now" S %=1 D YN^DICN Q:% I '% W !!?5,SPNYESNO
|
---|
48 | S (SPNNEXT,SPNQUIT)=(%=-1) Q:SPNQUIT S SPNNEXT=(%=1)
|
---|
49 | Q
|
---|
50 | SAVDHD(Y,X) ; *** Save DHD into the Ad Hoc Macro file
|
---|
51 | I $G(^SPNL(154.8,+Y,0))]"",$P(Y,U,4)="SAVE" S $P(^SPNL(154.8,+Y,0),U,6)=X
|
---|
52 | Q
|
---|
53 | SAVDIPCR(Y,X) ; *** Save DIPCRIT into the Ad Hoc Macro file
|
---|
54 | I $G(^SPNL(154.8,+Y,0))]"",$P(Y,U,4)="SAVE" D
|
---|
55 | . N DA,DIE,DR S DIE="^SPNL(154.8,",DA=+Y,DR=".05///^S X="_X D ^DIE
|
---|
56 | . Q
|
---|
57 | Q
|
---|