PSXCST1 ;BIR/JMB-Date Range Compile/Recompile Cost Data-CONTINUED ;[ 04/08/97 2:06 PM ]
;;2.0;CMOP;;11 Apr 97
RECOM1 ;Gets last month that is compiled with monthly data. (3 months ago)
;E.g. Today=11/3/94, 8/94 is last date to be compiled with monthly data.
S PSXMON=$E(DT,4,5),PSXMON=$P("10^11^12^01^02^03^04^05^06^07^08^09","^",PSXMON) S PSXYR=$S(+PSXMON>9:($E(DT,1,3)-1),1:$E(DT,1,3)),PSXCUT=PSXYR_PSXMON_"00"
;If PSXBEG's yr & mon > 2 mons ago, set PSXBEG to 3 months ago & queue
;monthly data. Then set 2 months ago to PSXEND & compile daily data.
I $E(PSXBEG,1,5)<$E(PSXCUT,1,5) S PSXBDT=PSXBEG,PSXEDT=$S($E(PSXEND,1,5)<$E(PSXCUT,1,5):PSXEND,1:PSXCUT),PSXCOM=0 D QUE^PSXCST Q:$G(PSXERR) G:PSXEND=PSXEDT END^PSXCSUTL D Q:$G(PSXERR)
.S PSXBDT=$S($E(PSXCUT,4,5)=12:$E(PSXCUT,1,3)+1,1:$E(PSXCUT,1,3))_$P("02^03^04^05^06^07^08^09^10^11^12^01","^",$E(PSXCUT,4,5))_"01",PSXEDT=PSXEND,PSXCOM=2 D QUE^PSXCST
;If PSXBEG's yr & mon are 3 months ago, send PSXBEG's month for monthly
;compile. If PSXEND is not same yr & mon as PSXBEG, send 2 months ago to
;PSXEND for daily compile.
I $E(PSXBEG,1,5)=$E(PSXCUT,1,5) S (PSXBDT,PSXEDT)=PSXCUT,PSXCOM=0 D QUE^PSXCST Q:$G(PSXERR) D
.Q:$E(PSXBEG,1,5)=$E(PSXEND,1,5)
.S PSXNEXT=$S($E(PSXCUT,4,5)=12:$E(PSXCUT,1,3)+1,1:$E(PSXCUT,1,3))_$P("02^03^04^05^06^07^08^09^10^11^12^01","^",$E(PSXCUT,4,5))
.S PSXBDT=PSXNEXT_"00",PSXEDT=PSXEND,PSXCOM=2 D QUE^PSXCST Q:$G(PSXERR)
;If PSXBEG is before monthly data should be compiled, send PSXBEG to
;PSXEND for daily compilation.
I $E(PSXBEG,1,5)>$E(PSXCUT,1,5) S PSXBDT=PSXBEG,PSXEDT=PSXEND,PSXCOM=2 D QUE^PSXCST Q:$G(PSXERR)
G END^PSXCSUTL
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSXCST1 1661 printed Dec 13, 2024@01:43:55 Page 2
PSXCST1 ;BIR/JMB-Date Range Compile/Recompile Cost Data-CONTINUED ;[ 04/08/97 2:06 PM ]
+1 ;;2.0;CMOP;;11 Apr 97
RECOM1 ;Gets last month that is compiled with monthly data. (3 months ago)
+1 ;E.g. Today=11/3/94, 8/94 is last date to be compiled with monthly data.
+2 SET PSXMON=$EXTRACT(DT,4,5)
SET PSXMON=$PIECE("10^11^12^01^02^03^04^05^06^07^08^09","^",PSXMON)
SET PSXYR=$SELECT(+PSXMON>9:($EXTRACT(DT,1,3)-1),1:$EXTRACT(DT,1,3))
SET PSXCUT=PSXYR_PSXMON_"00"
+3 ;If PSXBEG's yr & mon > 2 mons ago, set PSXBEG to 3 months ago & queue
+4 ;monthly data. Then set 2 months ago to PSXEND & compile daily data.
+5 IF $EXTRACT(PSXBEG,1,5)<$EXTRACT(PSXCUT,1,5)
SET PSXBDT=PSXBEG
SET PSXEDT=$SELECT($EXTRACT(PSXEND,1,5)<$EXTRACT(PSXCUT,1,5):PSXEND,1:PSXCUT)
SET PSXCOM=0
DO QUE^PSXCST
if $GET(PSXERR)
QUIT
if PSXEND=PSXEDT
GOTO END^PSXCSUTL
Begin DoDot:1
+6 SET PSXBDT=$SELECT($EXTRACT(PSXCUT,4,5)=12:$EXTRACT(PSXCUT,1,3)+1,1:$EXTRACT(PSXCUT,1,3))_$PIECE("02^03^04^05^06^07^08^09^10^11^12^01","^",$EXTRACT(PSXCUT,4,5))_"01"
SET PSXEDT=PSXEND
SET PSXCOM=2
DO QUE^PSXCST
End DoDot:1
if $GET(PSXERR)
QUIT
+7 ;If PSXBEG's yr & mon are 3 months ago, send PSXBEG's month for monthly
+8 ;compile. If PSXEND is not same yr & mon as PSXBEG, send 2 months ago to
+9 ;PSXEND for daily compile.
+10 IF $EXTRACT(PSXBEG,1,5)=$EXTRACT(PSXCUT,1,5)
SET (PSXBDT,PSXEDT)=PSXCUT
SET PSXCOM=0
DO QUE^PSXCST
if $GET(PSXERR)
QUIT
Begin DoDot:1
+11 if $EXTRACT(PSXBEG,1,5)=$EXTRACT(PSXEND,1,5)
QUIT
+12 SET PSXNEXT=$SELECT($EXTRACT(PSXCUT,4,5)=12:$EXTRACT(PSXCUT,1,3)+1,1:$EXTRACT(PSXCUT,1,3))_$PIECE("02^03^04^05^06^07^08^09^10^11^12^01","^",$EXTRACT(PSXCUT,4,5))
+13 SET PSXBDT=PSXNEXT_"00"
SET PSXEDT=PSXEND
SET PSXCOM=2
DO QUE^PSXCST
if $GET(PSXERR)
QUIT
End DoDot:1
+14 ;If PSXBEG is before monthly data should be compiled, send PSXBEG to
+15 ;PSXEND for daily compilation.
+16 IF $EXTRACT(PSXBEG,1,5)>$EXTRACT(PSXCUT,1,5)
SET PSXBDT=PSXBEG
SET PSXEDT=PSXEND
SET PSXCOM=2
DO QUE^PSXCST
if $GET(PSXERR)
QUIT
+17 GOTO END^PSXCSUTL