SCMCHLA ;ALB/KCL - PCMM HL7 Transmission Log File API'S ;25-JAN-2000
;;5.3;Scheduling;**210,272**;AUG 13, 1993
;
LOCK(SCTLIEN) ; Description: Used to lock a record in the PCMM HL7
; TANSMISSION LOG file.
;
; Input:
; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
;
; Output:
; Function Value: Returns 1 on success, 0 on faliure
;
I $G(SCTLIEN) L +^SCPT(404.471,SCTLIEN):3
;
Q $T
;
;
UNLOCK(SCTLIEN) ; Description: Used to unlock a record in the PCMM HL7
; TANSMISSION LOG file.
;
; Input:
; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
;
; Output: None
;
I $G(SCTLIEN) L -^SCPT(404.471,SCTLIEN)
Q
;
;
GETLOG(SCTLIEN,SCECIEN,TLOG) ;
; Description: Used to obtain a record in the PCMM HL7 TRANSMISSION LOG
; file and a record in the Error Code subfile. The field values will
; be returned in the TLOG array.
;
; Input:
; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
; SCECIEN - ien of record in the Error Code subfile
;
; Output:
; Function Value: Returns 1 on success, 0 on faliure
; TLOG - this is the name of a local array, it should be passed by
; reference. If the function is successful the array will
; contain the PCMM HL7 TRANSMISSION LOG record and the
; Error Code subfile record.
;
; subscript field name
; --------- ----------
; "MSGID" Message Control ID
; "DFN" Patient
; "TRANS" Transmission Date/Time
; "STATUS" Status
; "ACK DT/TM" ACK Received Date/Time
;
; Error Code subfile record:
; "ERR","CODE" Error Code
; "ERR","SEG" Segment
; "ERR","SEQ" Sequence
; "ERR","ZPCID" ZPC ID
; "ERR","EPS" Error Processing Status
;
N NODE
K TLOG S TLOG=""
Q:'$G(SCTLIEN) 0
;
S NODE=$G(^SCPT(404.471,SCTLIEN,0))
Q:(NODE="") 0
S TLOG("MSGID")=$P(NODE,"^")
S TLOG("DFN")=$P(NODE,"^",2)
S TLOG("TRANS")=$P(NODE,"^",3)
S TLOG("STATUS")=$P(NODE,"^",4)
S TLOG("ACK DT/TM")=$P(NODE,"^",5)
S TLOG("WORK")=$P(NODE,"^",7)
;
S TLOG("ERR")=""
I $G(SCECIEN) D
.S NODE=$G(^SCPT(404.471,SCTLIEN,"ERR",SCECIEN,0))
.S TLOG("ERR","CODE")=$P(NODE,"^")
.S TLOG("ERR","SEG")=$P(NODE,"^",2)
.S TLOG("ERR","SEQ")=$P(NODE,"^",3)
.S TLOG("ERR","ZPCID")=$P(NODE,"^",5)
.S TLOG("ERR","EPS")=$P(NODE,"^",6)
;
Q 1
;
;
STATUS(SCTLIEN) ;
; Description: Used to get STATUS field for record in PCMM HL7
; TRANSMISSION LOG file.
;
; Input:
; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
;
; Output:
; Funtion Value: Returns STATUS field value, null otherwise.
;
Q:'$G(SCTLIEN) ""
Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",4)
;
;
UPDSTAT(SCTLIEN,STATUS,ERROR) ;
; Description: Used to update the STATUS field of record in PCMM HL7
; TRANSMISSION LOG file.
;
; Input:
; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
; STATUS - T=Transmitted, A=Accepted, RJ=Rejected,
; M=Marked for re-transmission, RT=Re-transmitted
;
; Output:
; Funtion Value: Returns 1 on success, 0 on failure.
; ERROR - returns error message on failure, pass by reference
;
N SCERR,SCFDA,SCIENS
;
S ERROR=""
;
I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
I ",T,A,RJ,M,RT,"'[(","_$G(STATUS)_",") S ERROR="INVALID STATUS" Q 0
;
S SCIENS=SCTLIEN_","
S SCFDA(404.471,SCIENS,.04)=STATUS ; Status
D FILE^DIE("","SCFDA","SCERR")
;
D UNLOCK(SCTLIEN)
;
; if error returned from DBS call, unable to file data
I $G(SCERR) S ERROR="UNABLE TO UPDATE STATUS FIELD" Q 0
;
Q 1
;
;
INCLUDE(SCTLIEN) ;
; Description: Used to get INCLUDED IN REJECT BULLETIN? field for
; record in PCMM HL7 TRANSMISSION LOG file.
;
; Input:
; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
;
; Output:
; Funtion Value: Returns INCLUDED IN REJECT BULLETIN? field value, null otherwise.
;
Q:'$G(SCTLIEN) ""
Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",6)
;
;
UPDINCL(SCTLIEN,SCINCL,ERROR) ;
; Description: Used to update the INCLUDED IN REJECT BULLETIN? field of
; record in the PCMM HL7 TRANSMISSION LOG file.
;
; Input:
; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
; SCINCL - 'Y'=YES
;
; Output:
; Funtion Value: Returns 1 on success, 0 on failure.
; ERROR - returns error message on failure, pass by reference
;
N SCERR,SCFDA,SCIENS
;
S ERROR=""
;
I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
I $G(SCINCL)'="Y" S ERROR="INVALID FIELD VALUE" Q 0
I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
;
S SCIENS=SCTLIEN_","
S SCFDA(404.471,SCIENS,.06)=SCINCL ; Included In Reject Bulletin?
D FILE^DIE("","SCFDA","SCERR")
;
D UNLOCK(SCTLIEN)
;
; if error returned from DBS call, unable to file data
I $G(SCERR) S ERROR="UNABLE TO UPDATE 'INCLUDED IN REJECT BULLETIN?' FIELD" Q 0
;
Q 1
;
;
ACK(SCTLIEN) ;
; Description: Used to get ACK RECEIVED DATE/TIME field for
; record in PCMM HL7 TRANSMISSION LOG file.
;
; Input:
; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
;
; Output:
; Funtion Value: Returns ACK RECEIVED DATE/TIME field value, 0 otherwise.
;
Q:'$G(SCTLIEN) 0
Q $P($G(^SCPT(404.471,SCTLIEN,0)),"^",5)
;
;
UPDEPS(SCTLIEN,SCERIEN,EPSTAT,ERROR) ;
; Description: Used to update the ERROR PROCESSING STATUS field of
; record in the Error Code (#404.47142) subfile.
;
; Input:
; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
; SCERIEN - IEN record in ERROR CODE (#404.47142) subfile
; EPSTAT - 1=NEW, 2=CHECKED
;
; Output:
; Funtion Value: Returns 1 on success, 0 on failure.
; ERROR - returns error message on failure, pass by reference
;
N SCERR,SCFDA,SCIENS,STATUS
;
S ERROR=""
;
I '$G(SCTLIEN) S ERROR="NO RECORD SPECIFIED" Q 0
I '$G(SCERIEN) S ERROR="NO SUB-RECORD SPECIFIED" Q 0
I '$G(EPSTAT) S ERROR="INVALID ERROR PROCESSING STATUS" Q 0
S STATUS=$$STATUS(SCTLIEN)
I (STATUS'="RJ")&(STATUS'="M") S ERROR="STATUS IS NOT 'REJECTED' OR 'MARKED FOR RE-TRANSMIT'" Q 0
I '$$LOCK(SCTLIEN) S ERROR="UNABLE TO OBTAIN LOCK ON RECORD" Q 0
;
S SCIENS=SCERIEN_","_SCTLIEN_","
S SCFDA(404.47142,SCIENS,.06)=EPSTAT ; Error Processing Status
D FILE^DIE("","SCFDA","SCERR")
;
D UNLOCK(SCTLIEN)
;
; if error returned from DBS call, unable to file data
I $G(SCERR) S ERROR="UNABLE TO UPDATE STATUS FIELD" Q 0
;
Q 1
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSCMCHLA 6724 printed Nov 22, 2024@17:50:19 Page 2
SCMCHLA ;ALB/KCL - PCMM HL7 Transmission Log File API'S ;25-JAN-2000
+1 ;;5.3;Scheduling;**210,272**;AUG 13, 1993
+2 ;
LOCK(SCTLIEN) ; Description: Used to lock a record in the PCMM HL7
+1 ; TANSMISSION LOG file.
+2 ;
+3 ; Input:
+4 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
+5 ;
+6 ; Output:
+7 ; Function Value: Returns 1 on success, 0 on faliure
+8 ;
+9 IF $GET(SCTLIEN)
LOCK +^SCPT(404.471,SCTLIEN):3
+10 ;
+11 QUIT $TEST
+12 ;
+13 ;
UNLOCK(SCTLIEN) ; Description: Used to unlock a record in the PCMM HL7
+1 ; TANSMISSION LOG file.
+2 ;
+3 ; Input:
+4 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
+5 ;
+6 ; Output: None
+7 ;
+8 IF $GET(SCTLIEN)
LOCK -^SCPT(404.471,SCTLIEN)
+9 QUIT
+10 ;
+11 ;
GETLOG(SCTLIEN,SCECIEN,TLOG) ;
+1 ; Description: Used to obtain a record in the PCMM HL7 TRANSMISSION LOG
+2 ; file and a record in the Error Code subfile. The field values will
+3 ; be returned in the TLOG array.
+4 ;
+5 ; Input:
+6 ; SCTLIEN - ien of a record in the PCMM HL7 TRANSMISSION LOG file
+7 ; SCECIEN - ien of record in the Error Code subfile
+8 ;
+9 ; Output:
+10 ; Function Value: Returns 1 on success, 0 on faliure
+11 ; TLOG - this is the name of a local array, it should be passed by
+12 ; reference. If the function is successful the array will
+13 ; contain the PCMM HL7 TRANSMISSION LOG record and the
+14 ; Error Code subfile record.
+15 ;
+16 ; subscript field name
+17 ; --------- ----------
+18 ; "MSGID" Message Control ID
+19 ; "DFN" Patient
+20 ; "TRANS" Transmission Date/Time
+21 ; "STATUS" Status
+22 ; "ACK DT/TM" ACK Received Date/Time
+23 ;
+24 ; Error Code subfile record:
+25 ; "ERR","CODE" Error Code
+26 ; "ERR","SEG" Segment
+27 ; "ERR","SEQ" Sequence
+28 ; "ERR","ZPCID" ZPC ID
+29 ; "ERR","EPS" Error Processing Status
+30 ;
+31 NEW NODE
+32 KILL TLOG
SET TLOG=""
+33 if '$GET(SCTLIEN)
QUIT 0
+34 ;
+35 SET NODE=$GET(^SCPT(404.471,SCTLIEN,0))
+36 if (NODE="")
QUIT 0
+37 SET TLOG("MSGID")=$PIECE(NODE,"^")
+38 SET TLOG("DFN")=$PIECE(NODE,"^",2)
+39 SET TLOG("TRANS")=$PIECE(NODE,"^",3)
+40 SET TLOG("STATUS")=$PIECE(NODE,"^",4)
+41 SET TLOG("ACK DT/TM")=$PIECE(NODE,"^",5)
+42 SET TLOG("WORK")=$PIECE(NODE,"^",7)
+43 ;
+44 SET TLOG("ERR")=""
+45 IF $GET(SCECIEN)
Begin DoDot:1
+46 SET NODE=$GET(^SCPT(404.471,SCTLIEN,"ERR",SCECIEN,0))
+47 SET TLOG("ERR","CODE")=$PIECE(NODE,"^")
+48 SET TLOG("ERR","SEG")=$PIECE(NODE,"^",2)
+49 SET TLOG("ERR","SEQ")=$PIECE(NODE,"^",3)
+50 SET TLOG("ERR","ZPCID")=$PIECE(NODE,"^",5)
+51 SET TLOG("ERR","EPS")=$PIECE(NODE,"^",6)
End DoDot:1
+52 ;
+53 QUIT 1
+54 ;
+55 ;
STATUS(SCTLIEN) ;
+1 ; Description: Used to get STATUS field for record in PCMM HL7
+2 ; TRANSMISSION LOG file.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
+6 ;
+7 ; Output:
+8 ; Funtion Value: Returns STATUS field value, null otherwise.
+9 ;
+10 if '$GET(SCTLIEN)
QUIT ""
+11 QUIT $PIECE($GET(^SCPT(404.471,SCTLIEN,0)),"^",4)
+12 ;
+13 ;
UPDSTAT(SCTLIEN,STATUS,ERROR) ;
+1 ; Description: Used to update the STATUS field of record in PCMM HL7
+2 ; TRANSMISSION LOG file.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
+6 ; STATUS - T=Transmitted, A=Accepted, RJ=Rejected,
+7 ; M=Marked for re-transmission, RT=Re-transmitted
+8 ;
+9 ; Output:
+10 ; Funtion Value: Returns 1 on success, 0 on failure.
+11 ; ERROR - returns error message on failure, pass by reference
+12 ;
+13 NEW SCERR,SCFDA,SCIENS
+14 ;
+15 SET ERROR=""
+16 ;
+17 IF '$GET(SCTLIEN)
SET ERROR="NO RECORD SPECIFIED"
QUIT 0
+18 IF '$$LOCK(SCTLIEN)
SET ERROR="UNABLE TO OBTAIN LOCK ON RECORD"
QUIT 0
+19 IF ",T,A,RJ,M,RT,"'[(","_$GET(STATUS)_",")
SET ERROR="INVALID STATUS"
QUIT 0
+20 ;
+21 SET SCIENS=SCTLIEN_","
+22 ; Status
SET SCFDA(404.471,SCIENS,.04)=STATUS
+23 DO FILE^DIE("","SCFDA","SCERR")
+24 ;
+25 DO UNLOCK(SCTLIEN)
+26 ;
+27 ; if error returned from DBS call, unable to file data
+28 IF $GET(SCERR)
SET ERROR="UNABLE TO UPDATE STATUS FIELD"
QUIT 0
+29 ;
+30 QUIT 1
+31 ;
+32 ;
INCLUDE(SCTLIEN) ;
+1 ; Description: Used to get INCLUDED IN REJECT BULLETIN? field for
+2 ; record in PCMM HL7 TRANSMISSION LOG file.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
+6 ;
+7 ; Output:
+8 ; Funtion Value: Returns INCLUDED IN REJECT BULLETIN? field value, null otherwise.
+9 ;
+10 if '$GET(SCTLIEN)
QUIT ""
+11 QUIT $PIECE($GET(^SCPT(404.471,SCTLIEN,0)),"^",6)
+12 ;
+13 ;
UPDINCL(SCTLIEN,SCINCL,ERROR) ;
+1 ; Description: Used to update the INCLUDED IN REJECT BULLETIN? field of
+2 ; record in the PCMM HL7 TRANSMISSION LOG file.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
+6 ; SCINCL - 'Y'=YES
+7 ;
+8 ; Output:
+9 ; Funtion Value: Returns 1 on success, 0 on failure.
+10 ; ERROR - returns error message on failure, pass by reference
+11 ;
+12 NEW SCERR,SCFDA,SCIENS
+13 ;
+14 SET ERROR=""
+15 ;
+16 IF '$GET(SCTLIEN)
SET ERROR="NO RECORD SPECIFIED"
QUIT 0
+17 IF $GET(SCINCL)'="Y"
SET ERROR="INVALID FIELD VALUE"
QUIT 0
+18 IF '$$LOCK(SCTLIEN)
SET ERROR="UNABLE TO OBTAIN LOCK ON RECORD"
QUIT 0
+19 ;
+20 SET SCIENS=SCTLIEN_","
+21 ; Included In Reject Bulletin?
SET SCFDA(404.471,SCIENS,.06)=SCINCL
+22 DO FILE^DIE("","SCFDA","SCERR")
+23 ;
+24 DO UNLOCK(SCTLIEN)
+25 ;
+26 ; if error returned from DBS call, unable to file data
+27 IF $GET(SCERR)
SET ERROR="UNABLE TO UPDATE 'INCLUDED IN REJECT BULLETIN?' FIELD"
QUIT 0
+28 ;
+29 QUIT 1
+30 ;
+31 ;
ACK(SCTLIEN) ;
+1 ; Description: Used to get ACK RECEIVED DATE/TIME field for
+2 ; record in PCMM HL7 TRANSMISSION LOG file.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of PCM HL7 TRANSMISSION LOG file
+6 ;
+7 ; Output:
+8 ; Funtion Value: Returns ACK RECEIVED DATE/TIME field value, 0 otherwise.
+9 ;
+10 if '$GET(SCTLIEN)
QUIT 0
+11 QUIT $PIECE($GET(^SCPT(404.471,SCTLIEN,0)),"^",5)
+12 ;
+13 ;
UPDEPS(SCTLIEN,SCERIEN,EPSTAT,ERROR) ;
+1 ; Description: Used to update the ERROR PROCESSING STATUS field of
+2 ; record in the Error Code (#404.47142) subfile.
+3 ;
+4 ; Input:
+5 ; SCTLIEN - IEN of record in PCMM HL7 TRANSMISSION LOG file
+6 ; SCERIEN - IEN record in ERROR CODE (#404.47142) subfile
+7 ; EPSTAT - 1=NEW, 2=CHECKED
+8 ;
+9 ; Output:
+10 ; Funtion Value: Returns 1 on success, 0 on failure.
+11 ; ERROR - returns error message on failure, pass by reference
+12 ;
+13 NEW SCERR,SCFDA,SCIENS,STATUS
+14 ;
+15 SET ERROR=""
+16 ;
+17 IF '$GET(SCTLIEN)
SET ERROR="NO RECORD SPECIFIED"
QUIT 0
+18 IF '$GET(SCERIEN)
SET ERROR="NO SUB-RECORD SPECIFIED"
QUIT 0
+19 IF '$GET(EPSTAT)
SET ERROR="INVALID ERROR PROCESSING STATUS"
QUIT 0
+20 SET STATUS=$$STATUS(SCTLIEN)
+21 IF (STATUS'="RJ")&(STATUS'="M")
SET ERROR="STATUS IS NOT 'REJECTED' OR 'MARKED FOR RE-TRANSMIT'"
QUIT 0
+22 IF '$$LOCK(SCTLIEN)
SET ERROR="UNABLE TO OBTAIN LOCK ON RECORD"
QUIT 0
+23 ;
+24 SET SCIENS=SCERIEN_","_SCTLIEN_","
+25 ; Error Processing Status
SET SCFDA(404.47142,SCIENS,.06)=EPSTAT
+26 DO FILE^DIE("","SCFDA","SCERR")
+27 ;
+28 DO UNLOCK(SCTLIEN)
+29 ;
+30 ; if error returned from DBS call, unable to file data
+31 IF $GET(SCERR)
SET ERROR="UNABLE TO UPDATE STATUS FIELD"
QUIT 0
+32 ;
+33 QUIT 1