CLASSHR ;$O DPT B X-REF [ 02/20/03 2:45 PM ]
;This routine will $o thru B X-ref of name
;set counter = for each print each name - then start again
;
START ;
S TOTALCT=0
;S GRANDTOT=0
;D HEADING
S D="" F S D=$O(^DPT("B",D)) I D'="" S TOTALCT=TOTALCT+1 Q:D=""
;WRITE LAST NAME ACCESSED & GRAND TOTAL COUNT
;W !!,"LAST PATIENT DFN ACCESSED = ",LASTNAME
;W !," TOTAL COUNT-ALL RECORDS: ",TOTALCT
K D,TOTALCT
Q
PRINT ;GET DFN FOR NAME TO PRINT
;S X="" F S X=$O(^CLASSDMO("B",D,X)) Q:X'=+X S GRANDTOT=GRANDTOT+1 D PRINT1
;Q
PRINT1 ;PRINT ACTUAL NAME
;W !?5,TOTALCT,?15,$P(^CLASSDMO(X,0),U)
;W ?40,X,?45,$P(^CLASSDMO(X,0),U,10)
;S LASTNAME=X
;S TONISEX=$P(^CLASSDMO(X,0),U,8)
;W ?60,TONISEX
;I $D(^CLASSDMO(X,1,0)) D HOBBIES
;I $D(HOBBPRNT) W ?65,HOBBPRNT
;I TOTALCT>5 D HEADING S TOTALCT=0
;Q
;
HEADING ;Print Heading
;W !!,"EMPLOYEE: ",?15,"NAME",?39,"DFN",?45,"SSN",?60,"SEX",?65,"1 HOBBY",!
;Q
;
HOBBIES ;If Hobbies Exist - get one hobby dfn only
;S HOB1=""
;F S HOB1=$O(^CLASSDMO(X,1,"B",HOB1)) Q:HOB1="" D
. ;S HOBDFN="" F S HOBDFN=$O(^CLASSDMO(X,1,"B",HOB1,0)) HOBDFN'=+HOBDFN S HOBBY=$P(^CLASSDMO(X,1,HOBDFN,0),U),HOBBPRNT=$P(^CLASSHOB(HOBBY,0),U) Q
;Q