source: FOIAVistA/tag/r/NOIS-FSC/FSCUS.m@ 719

Last change on this file since 719 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 1.7 KB
Line 
1FSCUS ;SLC/STAFF-NOIS Utilities Sort ;4/22/94 12:36
2 ;;1.1;NOIS;;Sep 06, 1998
3 ;
4SORT(SORT) ; from FSCLMPOS, FSCRPTS
5 ; sorts ^TMP("FSC LIST CALLS",$J, globals using a sequence of fields
6 ; SORT(seq #) = zero node of field
7 ; SORT(sort seq #,"D") = "" (exists if field is to be sorted in descending order)
8 I '$O(SORT(0)) Q
9 N CALL,CHECK,CNT,DA,DESCEND,DIC,DIQ,DR,FLD,GBL,LASTCNT,LEN,LNUM,TMPSORT,TYPE,VAL,VALUE K DIQ,VALUE
10 S DESCEND="" K ^TMP("FSC SORT",$J)
11 F CNT=1:1 Q:'$D(SORT(CNT)) S LASTCNT=CNT I $D(SORT(CNT,"D")) S DESCEND=DESCEND_CNT_","
12 S LEN=60\LASTCNT I '$G(FSCDEV) W !
13 S DR="",CNT=0 F S CNT=$O(SORT(CNT)) Q:CNT<1 S DR=DR_$P(SORT(CNT),U,8)_";"
14 S DIC=7100,DIQ="VALUE",DIQ(0)="IE"
15 S CALL=0 F S CALL=$O(^TMP("FSC LIST CALLS",$J,"CX",CALL)) Q:CALL<1 D
16 .S DA=CALL K VALUE D EN^DIQ1
17 .S GBL="^TMP(""FSC SORT"",$J",CNT=0 F S CNT=$O(SORT(CNT)) Q:CNT<1 D
18 ..S FLD=$P(SORT(CNT),U,8),TYPE=$P(SORT(CNT),U,3)
19 ..S VAL=VALUE(7100,CALL,FLD,$S(TYPE["D":"I",1:"E"))
20 ..D
21 ...I TYPE["D"!(TYPE["N") S VAL=$S(VAL'<1:+VAL,$E(VAL)'=".":+VAL,VAL?1P1N.N:"0"_VAL,1:+VAL) I DESCEND[(CNT_",") S VAL=9999999-VAL Q
22 ...S VAL=$$UP^XLFSTR(VAL) I DESCEND[(CNT_",") S VAL=$TR(VAL,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ","9876543210ZYXWVUTSRQPONMLKJIHGFEDCBA")
23 ..S VAL=""""_$S(DESCEND[(CNT_",")&'$L(VAL):"Z",1:" ")_$E(VAL,1,LEN)_""""
24 ..S GBL=GBL_","_VAL
25 ..I '$O(SORT(CNT)) S GBL=GBL_","_CALL_")" S @GBL=CALL
26 K ^TMP("FSC LIST CALLS",$J),DIC,DIQ,VALUE
27 S VALMCNT=0,LNUM=0
28 S TMPSORT="^TMP(""FSC SORT"",$J)",CHECK="^TMP(""FSC SORT"","_$J_",""z"""
29 F S TMPSORT=$Q(@TMPSORT) Q:TMPSORT]CHECK S CALL=@TMPSORT D SETUP^FSCLML I (VALMCNT#10)=0 D CHECK^FSCLML(.VALMQUIT) I $D(VALMQUIT) S VALMBCK="Q" Q
30 K ^TMP("FSC SORT",$J)
31 I $D(VALMQUIT) Q
32 S ^TMP("FSC LIST CALLS",$J)=LNUM_U_VALMCNT
33 S VALMBG=1
34 Q
Note: See TracBrowser for help on using the repository browser.