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

SDECUTL1.m

Go to the documentation of this file.
SDECUTL1 ;ALB/SAT - VISTA SCHEDULING RPCS ;MAR 15, 2017
 ;;5.3;Scheduling;**627,642,658**;Aug 13, 1993;Build 23
 ;
 Q
 ;
GETBLKS(SDBLKS,SDPAT,SDAY,SDCLS,SDLEN,SDSI,SDCL)   ;build access block array SDBLKS from pattern SDPAT
 ;INPUT:
 ;  SDPAT - Pattern from CURRENT AVAILABILITY field of PATTERN multiple in file 44
 ;  SDAY  - date (no time) in FM format
 ;  SDCLS - hour clinic display begins from field 1914 in file 44
 ;  SDLEN - length of app't from field 1912 in file 44
 ;  SDSI  - display increments per hour
 ;RETURN:
 ; .SDBLKS - array of access block data to be stored in SDEC ACCESS BLOCK file
 ;           SDBLKS(<count>)=<start time> ^ <end time> ^ <slots> ^ <access type>
 N DTARRAY
 N SDATAV,SDATCA,SDATUN,SDF,SDI,SDSIM,SDSTPAT
 S SDF=0
 S SDATAV=$O(^SDEC(409.823,"B","AVAILABLE",0))
 S SDATCA=$O(^SDEC(409.823,"B","CANCELED",0))
 S SDATUN=$O(^SDEC(409.823,"B","UNAVAILABLE",0))
 ;SDSIM - calculated using DISPLAY INCREMENTS PER HOUR field from file 44
 ;          $S(X="":4,X<3:4,X:X,1:4)
 S SDSIM=$S(SDSI="":4,SDSI<3:4,SDSI:SDSI,1:4)
 ;S SDPAT=$E(SDPAT,SDSIM+SDSIM,90)
 S SDSTPAT=$G(^SC(SDCL,"ST",SDAY,1)) I SDSTPAT["CANCELLED" S SDF=1,SDSTPAT=$G(^SC(SDCL,"ST",SDAY,"CAN"))   ;get PATTERN from file 44
 D:SDSTPAT'="" ARRAY^SDECUTL2(.DTARRAY,SDSTPAT,SDAY,SDLEN,SDCLS,SDSI,+SDF)  ;convert pattern to array
 K SDBLKS
 ;1 2 3 4 OR 6
 D @SDSI
 Q
1  ;1 increments per hour (60 min)
 N AU,BCNT,BMIN,BSLOT,BSTART,BTIME,BSTOP,CNT,CNT1,HOUR,HR,HRP,P1,P2,SDCAN,SDTAR,SDI,SLOT,STA
 D A^SDECUT1A(.STA,SDCL,SDAY,SDSI,SDCLS)
 S SDI=0
 F CNT1=2:2 Q:+$E(SDPAT,CNT1)  Q:CNT1>$L(SDPAT)   ;find 1st slot ;might not be on the hour
 I CNT1>6 D
 .S BSTART=SDAY_"."_$S($L(SDCLS)=1:"0"_SDCLS,1:SDCLS)
 .S BTIME=SDCLS+(CNT1\8)
 .S HR=$S($L(BTIME)=1:"0"_BTIME,1:BTIME)
 .I '$D(STA(HR)) D STA
 .S BTIME=$S($L(BTIME)=1:"0"_BTIME,1:BTIME)_$S((CNT1#8)=4:$P(STA(HR,4),U,2),(CNT1#8)=6:$P(STA(HR,6),U,2),(CNT1#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S BSTOP=SDAY_"."_BTIME
 .S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_0_U_SDATUN
 S (BSLOT,BSTART)=""
 S HOUR=(SDCLS+(CNT1\8))-1
 F CNT=CNT1:8 D  Q:SLOT=""
 .S HOUR=HOUR+1   ;I (CNT#8)=2 S HOUR=HOUR+1
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S:BSTART="" BSTART=SDAY_"."_HR_$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S SDCAN=$G(DTARRAY(SDAY,HR))="X"
 .S SLOT=$S(SDCAN:"X",1:$E(SDPAT,CNT)) S SLOT=$S(SDCAN:"X",SLOT="":SLOT,+SLOT:SLOT,1:" ")
 .S:BSLOT="" BSLOT=$S(SLOT="X":SLOT,+SLOT:SLOT,1:" ")
 .I SLOT'=BSLOT D
 ..I BSLOT=" ",SLOT="",$E($P(BSTART,".",2),1,2)<18 Q
 ..S BMIN=$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 ..S BTIME=$S((BMIN="")&((HOUR#10)=0):$E(HOUR),1:$S($L(HOUR)=1:"0"_HOUR,1:HOUR))_$S(BMIN'="":BMIN,1:"")
 ..S BSTOP=SDAY_"."_BTIME
 ..I $E($P(BSTOP,".",2),1,2)>23 S BSTOP=$P(BSTOP,".",1)_".2359"
 ..S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_BSLOT_U_$S(BSLOT="X":SDATCA,BSLOT=" ":SDATUN,1:SDATAV)
 ..S BSLOT=$S(SLOT="X":"X",+SLOT:SLOT,1:" ")
 ..S BSTART=BSTOP   ;SDAY_"."_$S($L(HOUR)=1:"0"_HOUR,1:HOUR)   ;_$S((CNT#8)=4:15,(CNT#8)=6:3,(CNT#8)=0:45,1:"")
 .S BCNT=CNT
 I $E($P(BSTART,".",2),1,2)<18 S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_SDAY_"."_18_U_0_U_SDATUN
 Q
2  ;2 increments per hour (30 min)
 N AU,BCNT,BSLOT,BSTART,BSTOP,BTIME,CNT,CNT1,HOUR,HR,HRP,P1,P2,SDCAN,SDI,SDTAR,SLOT,STA
 S (BSLOT,BSTART,STA)=""
 S SDI=0
 S HOUR=SDCLS-1
 F CNT1=2:2 S:(CNT1#8)=2 HOUR=HOUR+1 Q:+$E(SDPAT,CNT1)  Q:CNT1>$L(SDPAT)   ;find 1st slot ;might not be on the hour
 Q:CNT1>$L(SDPAT)
 D A^SDECUT1A(.STA,SDCL,SDAY,SDSI,SDCLS)
 I CNT1>2 D
 .S BSTART=SDAY_"."_$S($L(SDCLS)=1:"0"_SDCLS,1:SDCLS)
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S BSTOP=SDAY_"."_HR_$S((CNT1#8)=4:$P(STA(HR,4),U,2),(CNT1#8)=6:$P(STA(HR,6),U,2),(CNT1#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .D MAKE(.SDBLKS,.SDI,BSTART,BSTOP,0)
 S BSTART=""
 I ((CNT1#8)=2)!((CNT1#8)=4) S HOUR=HOUR-1
 F CNT=CNT1:4 D  Q:SLOT=""
 .I ((CNT#8)=2)!((CNT#8)=4) S HOUR=HOUR+1
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S:BSTART="" BSTART=SDAY_"."_HR_$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S SDCAN=$G(DTARRAY(SDAY,HR_$S((CNT#8)=4:$P(STA(HR,4),U,1),(CNT#8)=6:$P(STA(HR,6),U,1),(CNT#8)=0:$P(STA(HR,0),U,1),1:$P(STA(HR,2),U,1))))="X"
 .S SLOT=$S(SDCAN:"X",1:$E(SDPAT,CNT)) S SLOT=$S(SDCAN:"X",SLOT="":SLOT,+SLOT:SLOT,1:" ")
 .S:BSLOT="" BSLOT=$S(SLOT="X":SLOT,+SLOT:SLOT,1:" ")
 .I SLOT'=BSLOT D
 ..I BSLOT=" ",SLOT="",$E($P(BSTART,".",2),1,2)<18 Q
 ..S BTIME=$S(((CNT#8)=2)&((HOUR#10)=0):$E(HOUR),1:$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2)))
 ..S BSTOP=SDAY_"."_BTIME
 ..I $E($P(BSTOP,".",2),1,2)>23 S BSTOP=$P(BSTOP,".",1)_".2359"
 ..S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_BSLOT_U_$S(BSLOT="X":SDATCA,BSLOT=" ":SDATUN,1:SDATAV)
 ..S BSLOT=$S(SLOT="X":"X",+SLOT:SLOT,1:" ")
 ..S BSTART=BSTOP   ;SDAY_"."_$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#8)=6:3,1:"")
 .S BCNT=CNT
 I $E($P(BSTART,".",2),1,2)<18 S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_SDAY_"."_18_U_U_SDATUN
 Q
3  ;3 increments per hour (20 min)
 N AU,BCNT,BSLOT,BSTART,BSTOP,BTIME,CNT,CNT1,HOUR,HR,HRP,P1,P2,SDCAN,SDI,SDTAR,SLOT,STA
 S (BSLOT,BSTART)=""
 S SDI=0
 S HOUR=SDCLS-1
 F CNT1=2:2 S:(CNT1#6)=2 HOUR=HOUR+1 Q:+$E(SDPAT,CNT1)  Q:CNT1>$L(SDPAT)   ;find 1st slot ;might not be on the hour
 Q:CNT1>$L(SDPAT)
 D A^SDECUT1A(.STA,SDCL,SDAY,SDSI,SDCLS)
 I CNT1>2 D
 .S BSTART=SDAY_"."_$S($L(SDCLS)=1:"0"_SDCLS,1:SDCLS)
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S BSTOP=SDAY_"."_HR_$S((CNT1#6)=4:$P(STA(HR,4),U,2),(CNT1#6)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .D MAKE(.SDBLKS,.SDI,BSTART,BSTOP,0)
 S BSTART=""
 I ((CNT1#6)=2) S HOUR=HOUR-1
 F CNT=CNT1:2 D  Q:SLOT=""
 .I (CNT#6)=2 S HOUR=HOUR+1
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S:BSTART="" BSTART=SDAY_"."_HR_$S((CNT#6)=4:$P(STA(HR,4),U,2),(CNT#6)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S SDCAN=$G(DTARRAY(SDAY,HR_$S((CNT#6)=4:$P(STA(HR,4),U,1),(CNT#6)=0:$P(STA(HR,0),U,1),1:$P(STA(HR,2),U,1))))="X"
 .S SLOT=$S(SDCAN:"X",1:$E(SDPAT,CNT)) S SLOT=$S(SDCAN:"X",SLOT="":SLOT,+SLOT:SLOT,1:" ")
 .S:BSLOT="" BSLOT=$S(SLOT="X":SLOT,+SLOT:SLOT,1:" ")
 .I SLOT'=BSLOT D
 ..I BSLOT=" ",SLOT="",$E($P(BSTART,".",2),1,2)<18 Q
 ..;S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 ..S BTIME=$S(((CNT#6)=2)&((HOUR#10)=0):$E(HOUR),1:$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#6)=4:$P(STA(HR,4),U,2),(CNT#6)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2)))
 ..S BSTOP=SDAY_"."_BTIME
 ..I $E($P(BSTOP,".",2),1,2)>23 S BSTOP=$P(BSTOP,".",1)_".2359"
 ..S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_BSLOT_U_$S(BSLOT="X":SDATCA,BSLOT=" ":SDATUN,1:SDATAV)
 ..S BSLOT=$S(SLOT="X":"X",+SLOT:SLOT,1:" ")
 ..S BSTART=BSTOP   ;SDAY_"."_$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#6)=4:2,(CNT#6)=0:4,1:"")
 .S BCNT=CNT
 I $E($P(BSTART,".",2),1,2)<18 S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_SDAY_"."_18_U_U_SDATUN
 Q
4  ;4 increments per hour (15 min)
 N AU,BCNT,BSLOT,BSTART,BSTOP,BTIME,CNT,CNT1,HOUR,HR,HRP,P1,P2,SDCAN,SDI,SDTAR,SLOT,STA
 S (BSLOT,BSTART,STA)=""
 S SDI=0
 D A^SDECUT1A(.STA,SDCL,SDAY,SDSI,SDCLS)
 S HOUR=SDCLS-1
 F CNT=2:2 D  Q:SLOT=""
 .I (CNT#8)=2 S HOUR=HOUR+1
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S:BSTART="" BSTART=SDAY_"."_HR_$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S SDCAN=$G(DTARRAY(SDAY,HR_$S((CNT#8)=4:$P(STA(HR,4),U,1),(CNT#8)=6:$P(STA(HR,6),U,1),(CNT#8)=0:$P(STA(HR,0),U,1),1:$P(STA(HR,2),U,1))))="X"
 .S SLOT=$S(SDCAN:"X",1:$E(SDPAT,CNT)) S SLOT=$S(SDCAN:"X",SLOT="":SLOT,+SLOT:SLOT,1:" ")
 .S:BSLOT="" BSLOT=$S(SLOT="X":SLOT,+SLOT:SLOT,1:" ")
 .I SLOT'=BSLOT D
 ..I BSLOT=" ",SLOT="",$E($P(BSTART,".",2),1,2)<18 Q
 ..S BTIME=$S(((CNT#8)=2)&((HOUR#10)=0):$E(HOUR),1:$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#8)=4:$P(STA(HR,4),U,2),(CNT#8)=6:$P(STA(HR,6),U,2),(CNT#8)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2)))
 ..S BSTOP=SDAY_"."_BTIME
 ..I $E($P(BSTOP,".",2),1,2)>23 S BSTOP=$P(BSTOP,".",1)_".2359"
 ..S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_BSLOT_U_$S(BSLOT="X":SDATCA,BSLOT=" ":SDATUN,1:SDATAV)
 ..S BSLOT=$S(SLOT="X":"X",+SLOT:SLOT,1:" ")
 ..S BSTART=BSTOP   ;SDAY_"."_$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#8)=4:15,(CNT#8)=6:3,(CNT#8)=0:45,1:"")
 .S BCNT=CNT
 I $E($P(BSTART,".",2),1,2)<18 S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_SDAY_"."_18_U_U_SDATUN
 Q
6  ;6 increments per hour (10 min)
 N AU,BCNT,BSLOT,BSTART,BSTOP,BTIME,CNT,CNT1,HOUR,HR,HRP,P1,P2,SDCAN,SDI,SDTAR,SLOT,STA
 S (BSLOT,BSTART)=""
 S SDI=0
 D A^SDECUT1A(.STA,SDCL,SDAY,SDSI,SDCLS)
 S HOUR=SDCLS-1
 F CNT=2:2 D  Q:SLOT=""
 .I (CNT#12)=2 S HOUR=HOUR+1
 .S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 .I '$D(STA(HR)) D STA
 .S:BSTART="" BSTART=SDAY_"."_HR_$S((CNT#12)=4:$P(STA(HR,4),U,2),(CNT#12)=6:$P(STA(HR,6),U,2),(CNT#12)=8:$P(STA(HR,8),U,2),(CNT#12)=10:$P(STA(HR,10),U,2),(CNT#12)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 .S SDCAN=$G(DTARRAY(SDAY,$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#12)=4:$P(STA(HR,4),U,1),(CNT#12)=6:$P(STA(HR,6),U,1),(CNT#12)=8:$P(STA(HR,8),U,1),(CNT#12)=10:$P(STA(HR,10),U,1),(CNT#12)=0:$P(STA(HR,0),U,1),1:$P(STA(HR,2),U,1))))="X"
 .S SLOT=$S(SDCAN:"X",1:$E(SDPAT,CNT)) S SLOT=$S(SDCAN:"X",SLOT="":SLOT,+SLOT:SLOT,1:" ")
 .S:BSLOT="" BSLOT=$S(SLOT="X":SLOT,+SLOT:SLOT,1:" ")
 .I SLOT'=BSLOT D
 ..I BSLOT=" ",SLOT="",$E($P(BSTART,".",2),1,2)<18 Q
 ..S HR=$S($L(HOUR)=1:"0"_HOUR,1:HOUR)
 ..S BTIME=HR_$S((CNT#12)=4:$P(STA(HR,4),U,2),(CNT#12)=6:$P(STA(HR,6),U,2),(CNT#12)=8:$P(STA(HR,8),U,2),(CNT#12)=10:$P(STA(HR,10),U,2),(CNT#12)=0:$P(STA(HR,0),U,2),1:$P(STA(HR,2),U,2))
 ..S BSTOP=SDAY_"."_BTIME
 ..I $E($P(BSTOP,".",2),1,2)>23 S BSTOP=$P(BSTOP,".",1)_".2359"
 ..S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_BSTOP_U_BSLOT_U_$S(BSLOT="X":SDATCA,BSLOT=" ":SDATUN,1:SDATAV)
 ..S BSLOT=$S(SLOT="X":"X",+SLOT:SLOT,1:" ")
 ..S BSTART=BSTOP   ;SDAY_"."_$S($L(HOUR)=1:"0"_HOUR,1:HOUR)_$S((CNT#12)=4:1,(CNT#12)=6:2,(CNT#12)=8:3,(CNT#12)=10:4,(CNT#12)=0:5,1:"")
 .S BCNT=CNT
 I $E($P(BSTART,".",2),1,2)<18 S SDI=SDI+1 S SDBLKS(SDI)=BSTART_U_SDAY_"."_18_U_U_SDATUN
 Q
STA ;
 N HRP
 S HRP=HR-1 S HRP=$S($L(HRP)=1:"0"_HRP,1:HRP)
 I $D(STA(HRP)) D
 .S STA(HR,4)=STA(HRP,4)
 .S:SDSI'=3 STA(HR,6)=STA(HRP,6)
 .S:SDSI=6 STA(HR,8)=STA(HRP,8)
 .S:SDSI=6 STA(HR,10)=STA(HRP,10)
 .S STA(HR,0)=STA(HRP,0)
 .S STA(HR,2)=STA(HRP,2)
 E  X "D B"_SDSI_"^SDECUT1A(.STA,"""_HR_""",0)"
 Q
 ;
MAKE(SDBLKS,SDI,START,STOP,SLOT)  ;make block
 N SDATAV,SDATUN
 S SDATAV=$O(^SDEC(409.823,"B","AVAILABLE",0))
 S SDATUN=$O(^SDEC(409.823,"B","UNAVAILABLE",0))
 S SDI=SDI+1 S SDBLKS(SDI)=START_U_STOP_U_SLOT_U_$S(+SLOT:SDATAV,1:SDATUN)
 Q
 ;
RESNB(SDAB,SDBLKS,SDCL,SDAY,SDRES)  ;create/update access blocks for 1 day
 N SDI,SDJ,SDNOD,SDRESP
 Q:'$D(SDBLKS)
 Q:$G(SDAY)'?7N
 S SDRESP=$G(SDRES)
 ;delete all related access blocks
 ;build new access blocks with calls to RESNB1
 S SDI="" F  S SDI=$O(SDBLKS(SDI)) Q:SDI=""  D
 .S SDNOD=SDBLKS(SDI)
 .Q:$P($P(SDNOD,U,1),".",1)'=SDAY
 .D RESNB1(SDAB,SDCL,$P(SDNOD,U,1),$P(SDNOD,U,2),$P(SDNOD,U,3),$P(SDNOD,U,4),,$P(SDNOD,U,5))  ;alb/sat 658 add 8 param OBM
 Q
 ;
RESNBD(SDCL,SDAY,SDRESP) ;delete access blocks for the day
 Q
 ;
RESNB1(SDAB,SDCL,SDSTART,SDSTOP,SDSLOTS,SDAT,SDRES,OBM)  ;create/update 1 access block  ;alb/sat 658 add OBM
 ;INPUT:
 ; SDAB    - global name for access blocks - "^TMP("_$J_",""SDEC"",""BLKS"")"
 ; SDCL    - clinic ID pointer to HOSPITAL LOCATION file
 ;           not used if SDRES is passed in
 ; SDSTART - start time in FM format
 ; SDSTOP  - stop time in FM format
 ; SDSLOTS - number of slots
 ; SDAT    - access type ID pointer to SDEC ACCESS TYPE file
 ; SDRES   - resource ID pointer to SDEC RESOURCE file
 ;           only update this resource if passed in
 ;           calling routine needs to make sure SDRES belongs to the proper HOSPITAL LOCATION (sdcl)
 S SDRES=$G(SDRES)
 D RESNBR
 Q
 ;only update passed in resource
 I SDRES'="" I $D(^SDEC(409.831,"ALOC",SDCL,SDRES)) D RESNBR  Q
 ;update all resources if no resource passed in
 I SDRES="" S SDRES=0 F  S SDRES=$O(^SDEC(409.831,"ALOC",SDCL,SDRES)) Q:SDRES'>0  D RESNBR
 Q
RESNBR  ;create access block for 1 resource
 N SDCNT,SDFDA,SDIEN,SDIENS,SDMSG
 S (SDCNT,@SDAB@("CNT"))=$G(@SDAB@("CNT"))+1
 S @SDAB@(SDCNT)=SDRES_U_SDSTART_U_SDSTOP_U_SDSLOTS_U_SDAT_U_$G(OBM)   ;alb/sat 658 add OBM
 Q
 ;
DAY ;;^SUN^MON^TUES^WEDNES^THURS^FRI^SATUR
 ;
GETDAY(DATE)  ;return day of the week
 N DOW,RET
 S RET=""
 S DATE=$P($G(DATE),".",1)
 Q:DATE'?7N RET
 S DOW="S %=$E(DATE,1,3),I=$E(DATE,4,5),I=I>2&'(%#4)+$E(""144025036146"",I) X ""F %=%:-1:281 S I=%#4=1+1+I"" S RET=$P(""SUN^MON^TUES^WEDNES^THURS^FRI^SATUR"",U,$E(DATE,6,7)+I#7+1)_""DAY"""
 X DOW
 Q RET