VBECDCM0 ;hoifo/gjc-VBECS MAPPING TABLE add, edit & delete utilities.;Nov 21, 2002
;;2.0;VBEC;;Jun 05, 2015;Build 4
;
; main entry point for VBECS MAPPING TABLE (#6005) file operations
;
;Medical Device #:
;Note: The food and Drug Administration classifies this software as a
;medical device. As such, it may not be changed in any way.
;Modifications to this software may result in an adulterated medical
;device under 21CFR820, the use of which is considered to be a
;violation of US Federal Statutes. Acquiring and implementing this
;software through the Freedom of Information Act requires the
;implementer to assume total responsibility for the software, and
;become a registered manufacturer of a medical device, subject to FDA
;regulations.
;
;Call to $$NEWERR^%ZTER is supported by IA: 1621
;Call to FILE^DIE is supported by IA: 2053
;Call to $$NOW^XLFDT is supported by IA: 10103
;Execution of ^%ZOSF("TEST") is supported by IA: 10096
;
EN613 ;Initially populate the file with antigen/antibody data
;
I $$NEWERR^%ZTER N $ETRAP,$ESTACK S $ETRAP="D ERR^VBECDCU1"
E S X="D ERR^VBECDCU1",@^%ZOSF("TRAP")
I +$O(^VBEC(6005,"AA","61.3-"))'=61.3 D
.Q:'$$LOCK^VBECDCU2(61.3)
.W !!,"Adding site configured 'Antigen/Antibody' information into the VBECS MAPPING",!,"TABLE file (#6005)."
.S CNT=0
.F VBECANTI="AB","AN" D ;antibodies & antigens
..S VBECY=0 F S VBECY=$O(^LAB(61.3,"E",VBECANTI,VBECY)) Q:'VBECY D
...S VBECY(0)=$G(^LAB(61.3,VBECY,0)),CNT=CNT+1
...D POP6005^VBECDCM2(61.3,VBECY,$P(VBECY(0),U),$P(VBECY(0),U,2),VBECANTI)
...W:'(CNT#100) "."
...Q
..Q
.D UNLOCK^VBECDCU2(61.3)
.Q
S:+$O(^VBEC(6005,"AA","61.3-"))=61.3 VBECFLG=1
I W !!,CNT_" antibody/antigen record"_$S(CNT=1:"",1:"s")_" added.",!
;
;handle antigen/antibody edit, delete, and add events here
;
E D
.Q:'$$LOCK^VBECDCU2(61.3) S VBECFLG=0
.F VBECANTI="AB","AN" D ;antibodies & antigens
..S VBECY=0 F S VBECY=$O(^LAB(61.3,"E",VBECANTI,VBECY)) Q:'VBECY D
...S VBECY(0)=$G(^LAB(61.3,VBECY,0)),VBEC01=61.3_"-"_VBECY
...S VBECIEN=+$O(^VBEC(6005,"B",VBEC01,0))
...;
...;if antigen/antibody not filed in 6005, add it
...I 'VBECIEN S VBECFLG=1 D POP6005^VBECDCM2(61.3,VBECY,$P(VBECY(0),U),$P(VBECY(0),U,2),VBECANTI) Q
...S VBECIEN(0)=$G(^VBEC(6005,VBECIEN,0))
...;
...;check if the name or identifier attribute has been edited
...S VBECTOT=0,VBECTOT=$$CHECKSUM^VBECDCU2($P(VBECY(0),U))
...S VBECTOT=VBECTOT+$$CHECKSUM^VBECDCU2($P(VBECY(0),U,2))
...S VBECTOT=VBECTOT+$$CHECKSUM^VBECDCU2($P(VBECY(0),U,5))
...I VBECTOT'=$P(VBECIEN(0),U,6) D S VBECFLG=1 K VBECTOT
....S:$P(VBECY(0),U)'=$P(VBECIEN(0),U,2) VBECFDA(6005,VBECIEN_",",.02)=$P(VBECY(0),U)
....S:$P(VBECY(0),U,2)'=$P(VBECIEN(0),U,3) VBECFDA(6005,VBECIEN_",",.03)=$P(VBECY(0),U,2)
....S:$P(VBECY(0),U,5)'=$P(VBECIEN(0),U,4) VBECFDA(6005,VBECIEN_",",.04)=$P(VBECY(0),U,5)
....S VBECFDA(6005,VBECIEN_",",.05)="@"
....S VBECFDA(6005,VBECIEN_",",.06)=VBECTOT
....S VBECFDA(6005,VBECIEN_",",.07)=+$E($$NOW^XLFDT(),1,12)
....D FILE^DIE("","VBECFDA")
....Q
...;
...Q
..Q
.D UNLOCK^VBECDCU2(61.3)
.Q
D DELETE^VBECDCM2(61.3)
I $G(VBECFLG) W !!,"Antigen/Antibody information updated.",!
E W !!,"Antigen/Antibody information current, not updated.",!
D XIT^VBECDCM2
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVBECDCM0 3341 printed Oct 16, 2024@18:44:20 Page 2
VBECDCM0 ;hoifo/gjc-VBECS MAPPING TABLE add, edit & delete utilities.;Nov 21, 2002
+1 ;;2.0;VBEC;;Jun 05, 2015;Build 4
+2 ;
+3 ; main entry point for VBECS MAPPING TABLE (#6005) file operations
+4 ;
+5 ;Medical Device #:
+6 ;Note: The food and Drug Administration classifies this software as a
+7 ;medical device. As such, it may not be changed in any way.
+8 ;Modifications to this software may result in an adulterated medical
+9 ;device under 21CFR820, the use of which is considered to be a
+10 ;violation of US Federal Statutes. Acquiring and implementing this
+11 ;software through the Freedom of Information Act requires the
+12 ;implementer to assume total responsibility for the software, and
+13 ;become a registered manufacturer of a medical device, subject to FDA
+14 ;regulations.
+15 ;
+16 ;Call to $$NEWERR^%ZTER is supported by IA: 1621
+17 ;Call to FILE^DIE is supported by IA: 2053
+18 ;Call to $$NOW^XLFDT is supported by IA: 10103
+19 ;Execution of ^%ZOSF("TEST") is supported by IA: 10096
+20 ;
EN613 ;Initially populate the file with antigen/antibody data
+1 ;
+2 IF $$NEWERR^%ZTER
NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^VBECDCU1"
+3 IF '$TEST
SET X="D ERR^VBECDCU1"
SET @^%ZOSF("TRAP")
+4 IF +$ORDER(^VBEC(6005,"AA","61.3-"))'=61.3
Begin DoDot:1
+5 if '$$LOCK^VBECDCU2(61.3)
QUIT
+6 WRITE !!,"Adding site configured 'Antigen/Antibody' information into the VBECS MAPPING",!,"TABLE file (#6005)."
+7 SET CNT=0
+8 ;antibodies & antigens
FOR VBECANTI="AB","AN"
Begin DoDot:2
+9 SET VBECY=0
FOR
SET VBECY=$ORDER(^LAB(61.3,"E",VBECANTI,VBECY))
if 'VBECY
QUIT
Begin DoDot:3
+10 SET VBECY(0)=$GET(^LAB(61.3,VBECY,0))
SET CNT=CNT+1
+11 DO POP6005^VBECDCM2(61.3,VBECY,$PIECE(VBECY(0),U),$PIECE(VBECY(0),U,2),VBECANTI)
+12 if '(CNT#100)
WRITE "."
+13 QUIT
End DoDot:3
+14 QUIT
End DoDot:2
+15 DO UNLOCK^VBECDCU2(61.3)
+16 QUIT
End DoDot:1
+17 if +$ORDER(^VBEC(6005,"AA","61.3-"))=61.3
SET VBECFLG=1
+18 IF $TEST
WRITE !!,CNT_" antibody/antigen record"_$SELECT(CNT=1:"",1:"s")_" added.",!
+19 ;
+20 ;handle antigen/antibody edit, delete, and add events here
+21 ;
+22 IF '$TEST
Begin DoDot:1
+23 if '$$LOCK^VBECDCU2(61.3)
QUIT
SET VBECFLG=0
+24 ;antibodies & antigens
FOR VBECANTI="AB","AN"
Begin DoDot:2
+25 SET VBECY=0
FOR
SET VBECY=$ORDER(^LAB(61.3,"E",VBECANTI,VBECY))
if 'VBECY
QUIT
Begin DoDot:3
+26 SET VBECY(0)=$GET(^LAB(61.3,VBECY,0))
SET VBEC01=61.3_"-"_VBECY
+27 SET VBECIEN=+$ORDER(^VBEC(6005,"B",VBEC01,0))
+28 ;
+29 ;if antigen/antibody not filed in 6005, add it
+30 IF 'VBECIEN
SET VBECFLG=1
DO POP6005^VBECDCM2(61.3,VBECY,$PIECE(VBECY(0),U),$PIECE(VBECY(0),U,2),VBECANTI)
QUIT
+31 SET VBECIEN(0)=$GET(^VBEC(6005,VBECIEN,0))
+32 ;
+33 ;check if the name or identifier attribute has been edited
+34 SET VBECTOT=0
SET VBECTOT=$$CHECKSUM^VBECDCU2($PIECE(VBECY(0),U))
+35 SET VBECTOT=VBECTOT+$$CHECKSUM^VBECDCU2($PIECE(VBECY(0),U,2))
+36 SET VBECTOT=VBECTOT+$$CHECKSUM^VBECDCU2($PIECE(VBECY(0),U,5))
+37 IF VBECTOT'=$PIECE(VBECIEN(0),U,6)
Begin DoDot:4
+38 if $PIECE(VBECY(0),U)'=$PIECE(VBECIEN(0),U,2)
SET VBECFDA(6005,VBECIEN_",",.02)=$PIECE(VBECY(0),U)
+39 if $PIECE(VBECY(0),U,2)'=$PIECE(VBECIEN(0),U,3)
SET VBECFDA(6005,VBECIEN_",",.03)=$PIECE(VBECY(0),U,2)
+40 if $PIECE(VBECY(0),U,5)'=$PIECE(VBECIEN(0),U,4)
SET VBECFDA(6005,VBECIEN_",",.04)=$PIECE(VBECY(0),U,5)
+41 SET VBECFDA(6005,VBECIEN_",",.05)="@"
+42 SET VBECFDA(6005,VBECIEN_",",.06)=VBECTOT
+43 SET VBECFDA(6005,VBECIEN_",",.07)=+$EXTRACT($$NOW^XLFDT(),1,12)
+44 DO FILE^DIE("","VBECFDA")
+45 QUIT
End DoDot:4
SET VBECFLG=1
KILL VBECTOT
+46 ;
+47 QUIT
End DoDot:3
+48 QUIT
End DoDot:2
+49 DO UNLOCK^VBECDCU2(61.3)
+50 QUIT
End DoDot:1
+51 DO DELETE^VBECDCM2(61.3)
+52 IF $GET(VBECFLG)
WRITE !!,"Antigen/Antibody information updated.",!
+53 IF '$TEST
WRITE !!,"Antigen/Antibody information current, not updated.",!
+54 DO XIT^VBECDCM2
+55 QUIT
+56 ;