- ABSPOSL ; IHS/FCS/DRS - logging ;
- ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
- Q
- ; Lots of entry points called from lots of places.
- ;
- ; The job that reads the prescription does this:
- ; DO INIT^ABSPOSL(ABSBRXI,NODELETE) to init a new session
- ; It will also DO SETSLOT() for you and timestamp.
- ; NODELETE true will keep anything already there,
- ; otherwise, any previous data is deleted.
- ; DO LOG^ABSPOSL(text) to log an event
- ; DO RELSLOT^ABSPOSL to release the slot
- ;
- ; The job(s) that build the packet and handle the communications
- ; should do the following to stuff info into a prescription's log:
- ; DO SETSLOT^ABSPOSL(prescription ien)
- ; DO LOG^ABSPOSL(text) to log an event
- ; DO RELSLOT^ABSPOSL to release the slot
- ;
- ; DO LOG2LIST^ABSPOSL(text) to log to all IEN59 in RXILIST(IEN59)
- ; DO LOG2CLM^ABSPOSL(text,IEN02) to log all IEN59 represented
- ; in ^ABSPC(IEN02, claim
- ; DO LOG59(text,IEN59) to log to IEN59 (does SETSLOT/RELSLOT for you)
- ; DO LOGARRTO(root,slot) to log an entire array to IEN59
- ;
- ; DO FINDPREV(type[,start]) to find most recent slot of given n.type
- ; (type is the decimal suffix) start = optional start at this #
- ;
- ; Communications jobs - to not interfere with prescription numbers,
- ; add an extra .1 onto the index.
- ; DO INIT^ABSPOSL(.1)
- ; Processing responses (ABSPOSQ4) - tacks on .11
- ; Billing jobs - add an extra .2 onto the index - (DT+.2)
- ; Silent submitter (ABSPOSR1) - add .3 - (these will be DT+.3)
- ; Calls to ABSOPSRX - add .4 - (these will be DT+.4)
- ; Winnowing - ABSPOSK - add .5 - (these will be DT+.5)
- ; Back billing - add .6 (these will be DT+.6)
- ;
- ; The job(s) that handle the response should
- ; DO SETSLOT^ABSPOSL(prescription ien)
- ; DO LOG^ABSPOSL(text) to log an event
- ; DO DONE^ABSPOSL to close a session
- ; It will also do RELSLOT for you.
- ;
- ;
- ; Other functions:
- ; $$GETSLOT returns the slot # currently in use (as when you wish to
- ; use a different one and stack this one for later reuse)
- ; $$GETINDEX returns the position of the logging (a subscript,
- ; a copy of ^ABSPECP("LOG",slot #,0))
- ; $$GETINDEX(SLOT) gets it for some other given slot, not your own
- ; $$GETPLACE returns $$GETSLOT_","_$$GETINDEX
- ; $$EXISTS(SLOT) does this slot # exist?
- ;
- ;
- ; PRINTLOG(SLOT) to print the log of entire session from SLOT
- ; PRCLLOG("slot,line",claim#) to print the transmissions log
- ; excerpt relevant to claim#
- ;
- ; ^ABSPECP("LOG","LAST SLOT")=last # assigned ; obsolete
- ; ^ABSPECP("LOG","JOB",j)=# ; given $J, what's the log #
- ; ^ABSPECP("LOG",#)=time assigned^job number^time done
- ; ^ABSPECP("LOG",#,0)=last n assigned
- ; ^ABSPECP("LOG",#,n)=$H secs^event text
- ;
- ;
- LOG(TEXT,ECHO,SPECIAL) ;EP - log the event given by TEXT
- ; SPECIAL="D" to prefix with printable date, T time, DT both
- N H S H=$H
- N SLOT S SLOT=$G(^ABSPECP("LOG","JOB",$J)) Q:'SLOT
- N N S N=$G(^ABSPECP("LOG",SLOT,0))+1,^(0)=N
- I $G(SPECIAL)]"",SPECIAL["D"!(SPECIAL["T") D
- . N %,%H,%I,X,Y D NOW^%DTC S Y=% X ^DD("DD")
- . I SPECIAL'["D" S Y=$P(Y,"@",2)
- . I I SPECIAL'["T" S Y=$P(Y,"@")
- . S TEXT=Y_" "_TEXT
- S ^ABSPECP("LOG",SLOT,N)=$P(H,",",2)_"^"_$E(TEXT,1,200)
- ;S ECHO=0 ; temporary ; temporary ; temporary ; while testing tasking
- I $G(ECHO) D
- .N IO S IO=$I
- .U $P W:$X>0 ! W TEXT,!
- .U IO
- I $G(SPECIAL)=9999 S $P(^ABSPECP("LOG",SLOT),"^",3)=H
- Q
- INIT(SLOTNUM,NODELETE,TMSTAMP) ;EP - very first caller does this:
- ; TMSTAMP undef or 1 -> you'll get a one-line time stamp
- ; TMSTAMP = 0 -> you won't get it.
- ; TMSTAMP = -1 -> timestamp only if brand new log file
- I '$G(^ABSPECP("LOG","LAST SLOT")) D
- . N X S X=$O(^ABSPECP("LOG",999999999999),-1) S:'X X=99
- . S ^ABSPECP("LOG","LAST SLOT")=X\1
- F L +^ABSPECP("LOG"):300 Q:$T Q:'$$IMPOSS^ABSPOSUE("L","RTI","interlock on obtaining new log file slot",,"INIT",$T(+0))
- N SLOT
- I $G(SLOTNUM)'<1 D ; if a specific slot number was specified:
- . S SLOT=SLOTNUM
- E D ; SLOTNUM<1, a differential to add
- . I '$D(SLOTNUM) S SLOTNUM=0
- . S SLOT=^ABSPECP("LOG","LAST SLOT")+1+SLOTNUM ; add in the differential
- . ; check: slot doesn't exist
- . N STOP S STOP=0
- . F D Q:STOP S SLOT=SLOT+1
- . . ; want: nothing in this SLOT\1 range
- . . I $D(^ABSPECP("LOG",SLOT\1)) Q ; no, ^ABSPECP("LOG",xxx) defined
- . . I $O(^ABSPECP("LOG",SLOT\1))\1=(SLOT\1) Q ; no,^ABSPECP("LOG",xxx.yy) defined
- . . S STOP=1
- . S ^ABSPECP("LOG","LAST SLOT")=SLOT\1
- D SETSLOT(SLOT)
- I '$G(NODELETE) K ^ABSPECP("LOG",SLOT)
- I '$G(NODELETE)!('$D(^ABSPECP("LOG",SLOT,0))) S ^ABSPECP("LOG",SLOT,0)=0
- I $G(TMSTAMP)=-1 D ; we want a time stamp only if it's brand new file
- . S TMSTAMP='$D(^ABSPECP("LOG",SLOT,1))
- I $G(TMSTAMP)'=0 D ; only skip if TMSTAMP is explicitly 0
- . N %,%H,%I,X D NOW^%DTC S Y=% X ^DD("DD") D LOG(Y_" "_%H_" "_%_" "_SLOT)
- L -^ABSPECP("LOG")
- Q
- SETSLOT(SLOT) ;EP -
- S ^ABSPECP("LOG","JOB",$J)=SLOT
- ;L +^ABSPECP("LOG",SLOT):0 ZT:'$T
- I SLOT S ^ABSPECP("LOG",SLOT)=$H_"^"_$J
- Q
- RELSLOT ; EP -
- N SLOT S SLOT=$G(^ABSPECP("LOG","JOB",$J))
- I SLOT S $P(^ABSPECP("LOG","JOB",$J),U,2)="R"
- ;L -^ABSPECP("LOG",SLOT)
- Q
- ;
- GETSLOT() ;EP -
- N X S X=$G(^ABSPECP("LOG","JOB",$J)) ; = "" if you had none
- I X?.E1"^R" S X="" ; you (or prev user) had one, but it was released
- Q X
- ;
- GETINDEX(SLOT) Q $G(^ABSPECP("LOG",$S($D(SLOT):SLOT,1:$$GETSLOT),0))
- ;
- GETPLACE() ;EP -
- Q $$GETSLOT_","_$$GETINDEX
- ;
- DONE ;EP -
- D LOG("DONE^ABSPOSL",0,9999)
- D RELSLOT
- K ^ABSPECP("LOG","JOB",$J)
- Q
- PRCLLOG(WHERE,CLAIM) ;EP - print portion of comms log related to given claim
- N SLOT,START,END,END1,X,FOUND
- S SLOT=$P(WHERE,","),START=$P(WHERE,",",2)
- S END=$$PRINTEND(SLOT) I 'END Q
- ; Is the START what we expect?
- ; this must match text at CLAIMBEG, CLAIMEND^ABSPOSAM
- S X=$G(^ABSPECP("LOG",SLOT,START))
- I $P(X,U,2)'[("CLAIM - BEGIN - #"_CLAIM) D Q
- .W "Found ",X,!
- .W " instead of expected beginning of claim ",CLAIM,".",!
- S FOUND=0 ; whether we found the expected end or not
- F END1=START+1:1:END D Q:FOUND ; with END1 pointing to the end
- .S X=$G(^ABSPECP("LOG",SLOT,END1))
- .I $P(X,U,2)[("CLAIM - END - #"_CLAIM) S FOUND=1
- I 'FOUND D
- .W "Did not find the expected end of claim transmission info.",!
- .W "We will print out some of what is there.",!
- .S END1=START+25 S:END1>END END1=END
- D PRINTLOG(SLOT,START,END1)
- Q
- PRINTEND(SLOT) ;EP -find the end of the logging session
- N END S END=$G(^ABSPECP("LOG",SLOT,0))
- I 'END D
- .W "Missing the 0 node that tells us where the end is?",!
- .S END=$O(^ABSPECP("LOG",SLOT,""),-1)
- .W "Working backwards, we think the end is at ",END,!
- Q END
- PRINTLOG(SLOT,START,END) ;EP -
- D PRINTLOG^ABSPOSL1(SLOT,$G(START),$G(END)) Q
- HDIF(THEN,NOW) Q $P(NOW,",")-$P(THEN,",")*86400+$P(NOW,",",2)-$P(THEN,",",2)
- EXISTS(X) ;EP -
- Q $D(^ABSPECP("LOG",X))
- FINDPREV(TYPE,START) ;
- I '$D(START) D Q:'START
- . I TYPE>1 S START=TYPE-1,TYPE=TYPE#1 Q
- . S START=+$G(^ABSPECP("LOG","LAST SLOT"))+1
- I START#1=0 S START=START+TYPE
- I START#1'=TYPE S START=START\1-1+TYPE
- F Q:$D(^ABSPECP("LOG",START)) S START=START-1 I START<1 S START="" Q
- Q START
- ; These logging utilities originally came from ABSPOSQ2
- LOG2LIST(MSG) ;EP - write MSG to the log files of all in RXILIST(*)
- N IEN59 S IEN59=0
- F S IEN59=$O(RXILIST(IEN59)) Q:'IEN59 D
- . D LOG59(MSG,IEN59)
- Q
- LOG2CLM(MSG,IEN02) ;EP - write MSG to log file for all claims in this 9002313.02
- N IEN59 S IEN59=0
- F S IEN59=$O(^ABSPT("AE",IEN02,IEN59)) Q:'IEN59 D
- . D LOG59(MSG,IEN59)
- Q
- LOG59(MSG,IEN59) ;EP -
- D LOG2SLOT(MSG,IEN59) Q
- ; obsolete:
- D SETSLOT(IEN59)
- D LOG(MSG)
- D RELSLOT
- Q
- LOG2SLOT(MSG,SLOT) ;EP -
- N OLDSLOT S OLDSLOT=$$GETSLOT
- D SETSLOT(SLOT)
- D LOG(MSG)
- D RELSLOT
- D SETSLOT(OLDSLOT)
- Q
- LOGARRAY(ROOT,SLOT,MAX) ;EP -
- N REF S REF=ROOT
- N COUNT S COUNT=0
- I '$D(MAX) S MAX=100
- I $D(@REF)#10'=1 S REF=$Q(@REF)
- F Q:REF="" D Q:'MAX
- . I $D(SLOT) D
- . . D LOG2SLOT(REF_"="_@REF,SLOT)
- . E D LOG(REF_"="_@REF)
- . S COUNT=COUNT+1
- . S REF=$Q(@REF)
- . S MAX=MAX-1
- I 'MAX,REF]"" D LOG2SLOT("More of "_ROOT_" to log, but max reached",SLOT)
- I 'COUNT D LOG2SLOT("Nothing found in "_ORIGROOT,SLOT)
- Q
- ABSPOSL ; IHS/FCS/DRS - logging ;
- +1 ;;1.0;PHARMACY POINT OF SALE;;JUN 21, 2001
- +2 QUIT
- +3 ; Lots of entry points called from lots of places.
- +4 ;
- +5 ; The job that reads the prescription does this:
- +6 ; DO INIT^ABSPOSL(ABSBRXI,NODELETE) to init a new session
- +7 ; It will also DO SETSLOT() for you and timestamp.
- +8 ; NODELETE true will keep anything already there,
- +9 ; otherwise, any previous data is deleted.
- +10 ; DO LOG^ABSPOSL(text) to log an event
- +11 ; DO RELSLOT^ABSPOSL to release the slot
- +12 ;
- +13 ; The job(s) that build the packet and handle the communications
- +14 ; should do the following to stuff info into a prescription's log:
- +15 ; DO SETSLOT^ABSPOSL(prescription ien)
- +16 ; DO LOG^ABSPOSL(text) to log an event
- +17 ; DO RELSLOT^ABSPOSL to release the slot
- +18 ;
- +19 ; DO LOG2LIST^ABSPOSL(text) to log to all IEN59 in RXILIST(IEN59)
- +20 ; DO LOG2CLM^ABSPOSL(text,IEN02) to log all IEN59 represented
- +21 ; in ^ABSPC(IEN02, claim
- +22 ; DO LOG59(text,IEN59) to log to IEN59 (does SETSLOT/RELSLOT for you)
- +23 ; DO LOGARRTO(root,slot) to log an entire array to IEN59
- +24 ;
- +25 ; DO FINDPREV(type[,start]) to find most recent slot of given n.type
- +26 ; (type is the decimal suffix) start = optional start at this #
- +27 ;
- +28 ; Communications jobs - to not interfere with prescription numbers,
- +29 ; add an extra .1 onto the index.
- +30 ; DO INIT^ABSPOSL(.1)
- +31 ; Processing responses (ABSPOSQ4) - tacks on .11
- +32 ; Billing jobs - add an extra .2 onto the index - (DT+.2)
- +33 ; Silent submitter (ABSPOSR1) - add .3 - (these will be DT+.3)
- +34 ; Calls to ABSOPSRX - add .4 - (these will be DT+.4)
- +35 ; Winnowing - ABSPOSK - add .5 - (these will be DT+.5)
- +36 ; Back billing - add .6 (these will be DT+.6)
- +37 ;
- +38 ; The job(s) that handle the response should
- +39 ; DO SETSLOT^ABSPOSL(prescription ien)
- +40 ; DO LOG^ABSPOSL(text) to log an event
- +41 ; DO DONE^ABSPOSL to close a session
- +42 ; It will also do RELSLOT for you.
- +43 ;
- +44 ;
- +45 ; Other functions:
- +46 ; $$GETSLOT returns the slot # currently in use (as when you wish to
- +47 ; use a different one and stack this one for later reuse)
- +48 ; $$GETINDEX returns the position of the logging (a subscript,
- +49 ; a copy of ^ABSPECP("LOG",slot #,0))
- +50 ; $$GETINDEX(SLOT) gets it for some other given slot, not your own
- +51 ; $$GETPLACE returns $$GETSLOT_","_$$GETINDEX
- +52 ; $$EXISTS(SLOT) does this slot # exist?
- +53 ;
- +54 ;
- +55 ; PRINTLOG(SLOT) to print the log of entire session from SLOT
- +56 ; PRCLLOG("slot,line",claim#) to print the transmissions log
- +57 ; excerpt relevant to claim#
- +58 ;
- +59 ; ^ABSPECP("LOG","LAST SLOT")=last # assigned ; obsolete
- +60 ; ^ABSPECP("LOG","JOB",j)=# ; given $J, what's the log #
- +61 ; ^ABSPECP("LOG",#)=time assigned^job number^time done
- +62 ; ^ABSPECP("LOG",#,0)=last n assigned
- +63 ; ^ABSPECP("LOG",#,n)=$H secs^event text
- +64 ;
- +65 ;
- LOG(TEXT,ECHO,SPECIAL) ;EP - log the event given by TEXT
- +1 ; SPECIAL="D" to prefix with printable date, T time, DT both
- +2 NEW H
- SET H=$HOROLOG
- +3 NEW SLOT
- SET SLOT=$GET(^ABSPECP("LOG","JOB",$JOB))
- IF 'SLOT
- QUIT
- +4 NEW N
- SET N=$GET(^ABSPECP("LOG",SLOT,0))+1
- SET ^(0)=N
- +5 IF $GET(SPECIAL)]""
- IF SPECIAL["D"!(SPECIAL["T")
- Begin DoDot:1
- +6 NEW %,%H,%I,X,Y
- DO NOW^%DTC
- SET Y=%
- XECUTE ^DD("DD")
- +7 IF SPECIAL'["D"
- SET Y=$PIECE(Y,"@",2)
- +8 IF $TEST
- IF SPECIAL'["T"
- SET Y=$PIECE(Y,"@")
- +9 SET TEXT=Y_" "_TEXT
- End DoDot:1
- +10 SET ^ABSPECP("LOG",SLOT,N)=$PIECE(H,",",2)_"^"_$EXTRACT(TEXT,1,200)
- +11 ;S ECHO=0 ; temporary ; temporary ; temporary ; while testing tasking
- +12 IF $GET(ECHO)
- Begin DoDot:1
- +13 NEW IO
- SET IO=$IO
- +14 USE $PRINCIPAL
- IF $X>0
- WRITE !
- WRITE TEXT,!
- +15 USE IO
- End DoDot:1
- +16 IF $GET(SPECIAL)=9999
- SET $PIECE(^ABSPECP("LOG",SLOT),"^",3)=H
- +17 QUIT
- INIT(SLOTNUM,NODELETE,TMSTAMP) ;EP - very first caller does this:
- +1 ; TMSTAMP undef or 1 -> you'll get a one-line time stamp
- +2 ; TMSTAMP = 0 -> you won't get it.
- +3 ; TMSTAMP = -1 -> timestamp only if brand new log file
- +4 IF '$GET(^ABSPECP("LOG","LAST SLOT"))
- Begin DoDot:1
- +5 NEW X
- SET X=$ORDER(^ABSPECP("LOG",999999999999),-1)
- IF 'X
- SET X=99
- +6 SET ^ABSPECP("LOG","LAST SLOT")=X\1
- End DoDot:1
- +7 FOR
- LOCK +^ABSPECP("LOG"):300
- IF $TEST
- QUIT
- IF '$$IMPOSS^ABSPOSUE("L","RTI","interlock on obtaining new log file slot",,"INIT",$TEXT(+0))
- QUIT
- +8 NEW SLOT
- +9 ; if a specific slot number was specified:
- IF $GET(SLOTNUM)'<1
- Begin DoDot:1
- +10 SET SLOT=SLOTNUM
- End DoDot:1
- +11 ; SLOTNUM<1, a differential to add
- IF '$TEST
- Begin DoDot:1
- +12 IF '$DATA(SLOTNUM)
- SET SLOTNUM=0
- +13 ; add in the differential
- SET SLOT=^ABSPECP("LOG","LAST SLOT")+1+SLOTNUM
- +14 ; check: slot doesn't exist
- +15 NEW STOP
- SET STOP=0
- +16 FOR
- Begin DoDot:2
- +17 ; want: nothing in this SLOT\1 range
- +18 ; no, ^ABSPECP("LOG",xxx) defined
- IF $DATA(^ABSPECP("LOG",SLOT\1))
- QUIT
- +19 ; no,^ABSPECP("LOG",xxx.yy) defined
- IF $ORDER(^ABSPECP("LOG",SLOT\1))\1=(SLOT\1)
- QUIT
- +20 SET STOP=1
- End DoDot:2
- IF STOP
- QUIT
- SET SLOT=SLOT+1
- +21 SET ^ABSPECP("LOG","LAST SLOT")=SLOT\1
- End DoDot:1
- +22 DO SETSLOT(SLOT)
- +23 IF '$GET(NODELETE)
- KILL ^ABSPECP("LOG",SLOT)
- +24 IF '$GET(NODELETE)!('$DATA(^ABSPECP("LOG",SLOT,0)))
- SET ^ABSPECP("LOG",SLOT,0)=0
- +25 ; we want a time stamp only if it's brand new file
- IF $GET(TMSTAMP)=-1
- Begin DoDot:1
- +26 SET TMSTAMP='$DATA(^ABSPECP("LOG",SLOT,1))
- End DoDot:1
- +27 ; only skip if TMSTAMP is explicitly 0
- IF $GET(TMSTAMP)'=0
- Begin DoDot:1
- +28 NEW %,%H,%I,X
- DO NOW^%DTC
- SET Y=%
- XECUTE ^DD("DD")
- DO LOG(Y_" "_%H_" "_%_" "_SLOT)
- End DoDot:1
- +29 LOCK -^ABSPECP("LOG")
- +30 QUIT
- SETSLOT(SLOT) ;EP -
- +1 SET ^ABSPECP("LOG","JOB",$JOB)=SLOT
- +2 ;L +^ABSPECP("LOG",SLOT):0 ZT:'$T
- +3 IF SLOT
- SET ^ABSPECP("LOG",SLOT)=$HOROLOG_"^"_$JOB
- +4 QUIT
- RELSLOT ; EP -
- +1 NEW SLOT
- SET SLOT=$GET(^ABSPECP("LOG","JOB",$JOB))
- +2 IF SLOT
- SET $PIECE(^ABSPECP("LOG","JOB",$JOB),U,2)="R"
- +3 ;L -^ABSPECP("LOG",SLOT)
- +4 QUIT
- +5 ;
- GETSLOT() ;EP -
- +1 ; = "" if you had none
- NEW X
- SET X=$GET(^ABSPECP("LOG","JOB",$JOB))
- +2 ; you (or prev user) had one, but it was released
- IF X?.E1"^R"
- SET X=""
- +3 QUIT X
- +4 ;
- GETINDEX(SLOT) QUIT $GET(^ABSPECP("LOG",$SELECT($DATA(SLOT):SLOT,1:$$GETSLOT),0))
- +1 ;
- GETPLACE() ;EP -
- +1 QUIT $$GETSLOT_","_$$GETINDEX
- +2 ;
- DONE ;EP -
- +1 DO LOG("DONE^ABSPOSL",0,9999)
- +2 DO RELSLOT
- +3 KILL ^ABSPECP("LOG","JOB",$JOB)
- +4 QUIT
- PRCLLOG(WHERE,CLAIM) ;EP - print portion of comms log related to given claim
- +1 NEW SLOT,START,END,END1,X,FOUND
- +2 SET SLOT=$PIECE(WHERE,",")
- SET START=$PIECE(WHERE,",",2)
- +3 SET END=$$PRINTEND(SLOT)
- IF 'END
- QUIT
- +4 ; Is the START what we expect?
- +5 ; this must match text at CLAIMBEG, CLAIMEND^ABSPOSAM
- +6 SET X=$GET(^ABSPECP("LOG",SLOT,START))
- +7 IF $PIECE(X,U,2)'[("CLAIM - BEGIN - #"_CLAIM)
- Begin DoDot:1
- +8 WRITE "Found ",X,!
- +9 WRITE " instead of expected beginning of claim ",CLAIM,".",!
- End DoDot:1
- QUIT
- +10 ; whether we found the expected end or not
- SET FOUND=0
- +11 ; with END1 pointing to the end
- FOR END1=START+1:1:END
- Begin DoDot:1
- +12 SET X=$GET(^ABSPECP("LOG",SLOT,END1))
- +13 IF $PIECE(X,U,2)[("CLAIM - END - #"_CLAIM)
- SET FOUND=1
- End DoDot:1
- IF FOUND
- QUIT
- +14 IF 'FOUND
- Begin DoDot:1
- +15 WRITE "Did not find the expected end of claim transmission info.",!
- +16 WRITE "We will print out some of what is there.",!
- +17 SET END1=START+25
- IF END1>END
- SET END1=END
- End DoDot:1
- +18 DO PRINTLOG(SLOT,START,END1)
- +19 QUIT
- PRINTEND(SLOT) ;EP -find the end of the logging session
- +1 NEW END
- SET END=$GET(^ABSPECP("LOG",SLOT,0))
- +2 IF 'END
- Begin DoDot:1
- +3 WRITE "Missing the 0 node that tells us where the end is?",!
- +4 SET END=$ORDER(^ABSPECP("LOG",SLOT,""),-1)
- +5 WRITE "Working backwards, we think the end is at ",END,!
- End DoDot:1
- +6 QUIT END
- PRINTLOG(SLOT,START,END) ;EP -
- +1 DO PRINTLOG^ABSPOSL1(SLOT,$GET(START),$GET(END))
- QUIT
- HDIF(THEN,NOW) QUIT $PIECE(NOW,",")-$PIECE(THEN,",")*86400+$PIECE(NOW,",",2)-$PIECE(THEN,",",2)
- EXISTS(X) ;EP -
- +1 QUIT $DATA(^ABSPECP("LOG",X))
- FINDPREV(TYPE,START) ;
- +1 IF '$DATA(START)
- Begin DoDot:1
- +2 IF TYPE>1
- SET START=TYPE-1
- SET TYPE=TYPE#1
- QUIT
- +3 SET START=+$GET(^ABSPECP("LOG","LAST SLOT"))+1
- End DoDot:1
- IF 'START
- QUIT
- +4 IF START#1=0
- SET START=START+TYPE
- +5 IF START#1'=TYPE
- SET START=START\1-1+TYPE
- +6 FOR
- IF $DATA(^ABSPECP("LOG",START))
- QUIT
- SET START=START-1
- IF START<1
- SET START=""
- QUIT
- +7 QUIT START
- +8 ; These logging utilities originally came from ABSPOSQ2
- LOG2LIST(MSG) ;EP - write MSG to the log files of all in RXILIST(*)
- +1 NEW IEN59
- SET IEN59=0
- +2 FOR
- SET IEN59=$ORDER(RXILIST(IEN59))
- IF 'IEN59
- QUIT
- Begin DoDot:1
- +3 DO LOG59(MSG,IEN59)
- End DoDot:1
- +4 QUIT
- LOG2CLM(MSG,IEN02) ;EP - write MSG to log file for all claims in this 9002313.02
- +1 NEW IEN59
- SET IEN59=0
- +2 FOR
- SET IEN59=$ORDER(^ABSPT("AE",IEN02,IEN59))
- IF 'IEN59
- QUIT
- Begin DoDot:1
- +3 DO LOG59(MSG,IEN59)
- End DoDot:1
- +4 QUIT
- LOG59(MSG,IEN59) ;EP -
- +1 DO LOG2SLOT(MSG,IEN59)
- QUIT
- +2 ; obsolete:
- +3 DO SETSLOT(IEN59)
- +4 DO LOG(MSG)
- +5 DO RELSLOT
- +6 QUIT
- LOG2SLOT(MSG,SLOT) ;EP -
- +1 NEW OLDSLOT
- SET OLDSLOT=$$GETSLOT
- +2 DO SETSLOT(SLOT)
- +3 DO LOG(MSG)
- +4 DO RELSLOT
- +5 DO SETSLOT(OLDSLOT)
- +6 QUIT
- LOGARRAY(ROOT,SLOT,MAX) ;EP -
- +1 NEW REF
- SET REF=ROOT
- +2 NEW COUNT
- SET COUNT=0
- +3 IF '$DATA(MAX)
- SET MAX=100
- +4 IF $DATA(@REF)#10'=1
- SET REF=$QUERY(@REF)
- +5 FOR
- IF REF=""
- QUIT
- Begin DoDot:1
- +6 IF $DATA(SLOT)
- Begin DoDot:2
- +7 DO LOG2SLOT(REF_"="_@REF,SLOT)
- End DoDot:2
- +8 IF '$TEST
- DO LOG(REF_"="_@REF)
- +9 SET COUNT=COUNT+1
- +10 SET REF=$QUERY(@REF)
- +11 SET MAX=MAX-1
- End DoDot:1
- IF 'MAX
- QUIT
- +12 IF 'MAX
- IF REF]""
- DO LOG2SLOT("More of "_ROOT_" to log, but max reached",SLOT)
- +13 IF 'COUNT
- DO LOG2SLOT("Nothing found in "_ORIGROOT,SLOT)
- +14 QUIT