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

IBCEP8C.m

Go to the documentation of this file.
IBCEP8C ;DSS/SCR - Functions for IB SILENT INTERFACE FROM FB ;03-27-12
 ;;2.0;INTEGRATED BILLING;**476**;21-MAR-94;Build 2
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ;
 ; This routine contains functions needed by the FB PAID TO IB OPTION to maintain
 ;    the 355.93 - IB VA NON/OTHER BILLING PROVIDER file
 ;
EPTRANS()  ;EP called from INPUT TRANSFORM IN THE .01 FIELD
 ;                              of 355.93 VA NON/OTHER BILLING PROVIDER file
 ;                                                
 ;Used only by the IB AUTOMATIC INTERFACE FROM FB to ADD a new entry or UPDATE an existing one
 ;
 S:IBPRVTYP=1 IBTYPE="F"
 S:IBPRVTYP=2 IBTYPE="I"
 S IBFBFLAG=1   ;USED BY THE NPI input transform to transfer code to interface and avoid user interaction
 ;
 Q
EPFBAPI(IBSRCREC,IBRETARY)  ;EP from FBTOIB^FBPAID3A
 ; INPUTS : IBSRCREC  - an array of information about this source record supplied by FB side
 ;
 ; OUTPUT : IBRETARY (passed by reference) populated with information about results of interface processing
 ;
 ;TO IB NON/OTHER VA BILLING PROVIDER FILE 355.93
 N IBRET
 ;
 S IBRET=$$IBNONVA(.IBSRCREC)   ;UPDATES THE IB NON/OTHER VA BILLING PROVIDER FILE
 S IBRETARY(1)=$P(IBRET,U,1)   ;The IEN of the IB record matched or created or NULL if neither
 S IBRETARY(2)=$P(IBRET,U,2)   ;A code from below indicating how NPI validation and record updates went
 ; '0' FOR NO NPI UPDATES ATTEMPTED;'1' FOR NPI DATA INVALID;'2' FOR NPI MATCHED ACTIVE, NO UPDATES;
 ; '3' FOR NPI MATCHED INACTIVE, NO UPDATES;'4' FOR NPI MATCHED ACTIVE, IB UPDATED; '5' FOR NPI NEW, IB RECORD CREATED;
 S IBRETARY(3)=$P(IBRET,U,3)   ;A code from below indicating how TXY updates went
 ;  '0' FOR NO TXY UPDATES ATTEMPTED;'1' FOR TXY CODE NOT FOUND IN 8932.1; '2' FOR MATCHED PRIMARY,NO UPDATES;
 ;'3' FOR MATCHED NON-PRIMARY, IB TXY UPDATES;'4' FOR NEW, IB TXY ENTRY CREATED;
 Q
 ;
IBNONVA(IBFBINF)  ;UPDATES TO #355.93
 ;  INPUTS  IBFBINF :  AN ARRAY OF INFORMATION FROM FB TO BE COMPARED/UPDATED IN IB NON/OTHER
 ;
 ;  LOOK UP BY NPI - should only be one match per provider type
 ;
 N IBQUIT,IBRTRN,IBDONE,IBFLGS,IBFLDS,IBIEN,IBSCRN,IBINDX,IBERR2,IBLKUP,IBOKTXY,IBOKNPI
 N IBERR,IBFBMLT,IBNPICHK,IBFDA,IBALLOW,IBOKFB,IBOK,IBPRVNPI,IBPRVTYP
 ;
 S IBQUIT=0
 S IBDONE=0
 S IBOKTXY=""
 S IBOKNPI=""
 S IBPRVTYP=IBFBINF("IB TYPE")
 S IBPRVNPI=IBFBINF("FBNPI")
 S IBPRVNAM=IBFBINF("NAME")
 S IBPRVTXY=IBFBINF("FBTXY")
 S IBFBDUZ=IBFBINF("FB SUP DUZ")
 ;
 I IBPRVNPI'="" D
 .N DO,X,%,%H,%I,X,IBNOW,DD,Y
 .D NOW^%DTC
 .S IBNOW=%
 .S IBPRVNAM=$$STRIP(IBPRVNAM)
 .S IBPRVNAM=$$UP^XLFSTR(IBPRVNAM)
 .S IBIEN=$$ACTVNPI(IBPRVNPI)  ;returns IEN of record with this NPI as 'active'
 .I IBIEN>0 D
 ..S IBFBMLT=0  ;FB MULTIPLE NOT YET UPDATED
 ..S IBOKNPI=2  ;MATCHED ACTIVE  NO UPDATES...will get changed if updates are made
 ..S IBOKTXY=0  ;NO TXY UPDATES ATTEMPTED
 ..;(#.01) NAME [1F] ; (#.02) PROVIDER TYPE [2S](#.05) STREETADDRESS [5F] ; (#.06) CITY [6F]; 
 ..;(#.07) STATE [7P:5] ^(#.08) ZIP CODE [8F] ; (#.09) FACILITY DEFAULT ID NUMBER[9F] ^(#.1) STREET ADDRESS LINE 2 [10F] ;
 ..;(#.13)PRIMARY ID QUALIFIER [13P:355.97];(#41.01) NPI [14F] 
 ..S IBFLDS=".01;.02;.05;.06;.07;.08;.09;.1;.13;41.01"
 ..D GETS^DIQ(355.93,IBIEN_",",IBFLDS,"I","IBRTRN","IBERR")  ; 355.93  IB NON/OTHER VA BILLING PROVIDER FILE
 ..I $G(IBERR("DIERR")) S IBQUIT=1
 ..Q:IBQUIT
 ..S IBALLOW=$$FBALLOW(IBIEN)   ;FIND OUT IF THIS PROVIDER SHOULD BE EDITED OR NOT
 ..Q:IBALLOW=0
 ..I IBRTRN(355.93,IBIEN_",",".02","I")=IBPRVTYP D SETIBFDA(.IBRTRN,.IBFBINF,.IBFDA,IBIEN)
 ..S IBOK=$$LOCK(IBIEN)  ;locks the #355.93  record
 ..Q:'IBOK
 ..I $D(IBFDA(355.93)) D
 ...S XQY0="FB AUTO INTERFACE TO IB"  ; MUST be set to pass the .01 input transform defined in PRVFMT^IBCEP8
 ...S IBFLPFLP=IBPRVTYP  ;needed for input transform
 ...D FILE^DIE("","IBFDA","IBERR")
 ...I $G(IBERR("DIERR")) S IBQUIT=1  ;FILE ATTEMPT RETURNED DB ERROR
 ...Q:IBQUIT
 ...S IBFBMLT=$$ADDFB(IBIEN,IBFBDUZ,IBNOW,0)
 ...S IBOKNPI=4  ; FOR NPI MATCHED ACTIVE, IB UPDATED;
 ..;CHECK TAXONOMY CODE
 ..I $G(IBPRVTXY)'="" D
 ...S IBOKTXY=$$CHKTXY(IBIEN,IBPRVTXY)  ;RETURNS A CODE FROM SET OF CODES - 0 IF NO CHANGES WERE MADE
 ...S:('+IBFBMLT)&((IBOKTXY=3)!(IBOKTXY=4)) IBFBMLT=$$ADDFB(IBIEN,IBFBDUZ,IBNOW,0)
 ...;add FB mult if not already added for other changes, and the txy was changed
 ..D UNLOCK(IBIEN)  ;Unlocks the #355.93  record
 ..S IBDONE=1   ;We have found a match on NPI
 .Q:IBQUIT 
 .Q:IBDONE
 .I IBIEN="" D
 ..S IBNPICHK=$$INACTV(IBPRVNPI) ;look for match on currently inactive
 ..I IBNPICHK'="" D
 ...S IBIEN=IBNPICHK  ;THE IEN OF THE record with this NPI as INACTIVE
 ...S IBOKNPI=3  ;FOR NPI MATCHED INACTIVE, NO UPDATES;
 ...S IBOKTXY=0    ;NO ATTEMPTED UPDATES
 ...S IBDONE=1
 ..Q:IBDONE
 ..S IBNPICHK=$$RULES(IBPRVNPI)  ;RETURN OF 0 means no problem
 ..I IBNPICHK>0 D
 ...;there is a match on an active NPI in the NEW PERSON or the INSTITUTION file
 ...S IBOKNPI=2   ;NPI MATCHED ACTIVE NO UPDATES
 ...S IBOKTXY=0
 ...S IBDONE=1
 ..Q:IBDONE
 ..;all checks have occurred, now we are going to add this PROVIDER/NPI
 ..S IBOK=$$LOCK()  ;locks the #355.93 file
 ..I 'IBOK Q
 ..N DIC,X,Y
 ..S DIC="^IBA(355.93,"
 ..S X=IBPRVNAM
 ..S DIC(0)=""
 ..S DIC("DR")=".02///"_IBPRVTYP
 ..I IBPRVTYP=1 D  ;ADD FACILITY INFORMATION
 ...I $G(IBFBINF("FBADD1"))'="" S DIC("DR")=DIC("DR")_";.05///"_IBFBINF("FBADD1")
 ...I $G(IBFBINF("FBADD2"))'="" S DIC("DR")=DIC("DR")_";.1///"_IBFBINF("FBADD2")
 ...I $G(IBFBINF("FBCITY"))'="" S DIC("DR")=DIC("DR")_";.06///"_IBFBINF("FBCITY")
 ...S:$G(IBFBINF("FBSTATE INT")) DIC("DR")=DIC("DR")_";.07///`"_IBFBINF("FBSTATE INT")  ;POINTER SO PUT INTO INTERNAL FORMAT
 ...S:$G(IBFBINF("FBZIP")) DIC("DR")=DIC("DR")_";.08///"_IBFBINF("FBZIP")
 ...I $G(IBFBINF("FBFACID"))'="" S DIC("DR")=DIC("DR")_";.09///"_IBFBINF("FBFACID")
 ..S DIC("DR")=DIC("DR")_";41.01///"_IBPRVNPI
 ..S XQY0="FB AUTO INTERFACE TO IB"  ; MUST be set to pass the .01 input transform defined in PRVFMT^IBCEP8
 ..S IBFLPFLP=IBPRVTYP  ;needed for successful 'three stuff' validation
 ..D FILE^DICN
 ..S IBIEN=+Y
 ..I IBIEN=-1 D
 ...S IBQUIT=1
 ...D UNLOCK()
 ..Q:IBQUIT
 ..S IBOKFB=$$ADDFB(IBIEN,IBFBDUZ,IBNOW,1)
 ..S IBOKNPI=$$ADDNPI(IBIEN,IBPRVNPI,IBFBDUZ,IBNOW)  ;returns 1 or 0
 ..S:IBOKNPI=1 IBOKNPI=5   ;NPI NEW, IB RECORD CREATED
 ..I $G(IBPRVTXY)'="" D
 ...S IBOK=$$ADDTXY(IBIEN,IBPRVTXY,1)
 ...S:IBOK IBOKTXY=4  ;FOR NEW TXY ENTRY CREATED
 ...S:'IBOK IBOKTXY=0  ;NO TXY UPDATES ATTEMPTED
 ..D UNLOCK()    ;unlocks the #355.93 file or a record
 S:$G(IBPRVTXY)="" IBOKTXY=0 ;NO TXY UPDATES ATTEMPTED
 S:$G(IBPRVNPI)="" IBOKNPI=0 ;NO NPI UPDATES ATTEMPTED
 I IBQUIT S IBIEN=""
 Q IBIEN_"^"_IBOKNPI_"^"_IBOKTXY
 ;
ADDFB(IBIEN,IBFBDUZ,IBNOW,IBFBADD)  ;ADD a multiple entry
 ; INPUTS : IBIEN: IEN OF THE IB NON/OTHER VA PROVIDER FILE being updated with NPI information
 ;          IBFBDUZ : IEN of the FB SUPERVISOR who certified the batch
 ;          IBNOW   : FM Date/time
 ;          IBFBADD : 1 if FB is just created the record 0 if not
 ;
 N IBFDA,IBIENRET,IBERR
 ;
 S IBQUIT=0
 S IBFDA(355.935,"+1,"_IBIEN_",",.01)=IBNOW  ;(#.01) DATE/TIME LAST FB UPDATE [1D]
 S IBFDA(355.935,"+1,"_IBIEN_",",.02)=IBFBDUZ  ;(#.02) DUZ OFFB SUP [2P:200]
 S:IBFBADD IBFDA(355.935,"+1,"_IBIEN_",",.03)=IBFBADD  ;(#.03) CREATED BY FB PAID TO IB[3S]
 D UPDATE^DIE("","IBFDA","IBIENRET","IBERR")
 I $G(IBERR("DIERR"))'="" S IBQUIT=1
 Q 'IBQUIT
 ;
ADDNPI(IBIEN,IBNPI,IBFBDUZ,IBNOW) ;ADD NPI multiple
 ; INPUTS : IBIEN: IEN OF THE IB NON/OTHER VA PROVIDER FILE being updated with NPI information
 ;          IBNPI : NPI STRING TO BE ADDED if it passes validation rules (we already know this 
 ;                    npi does not exist as an 'active' npi for a current entry in this file
 ;
 N IBFDA,IBERR,IBQUIT
 ;
 S IBQUIT=0
 S IBFDA(355.9301,"+1,"_IBIEN_",",.01)=IBNOW  ;355.9301  ;(#40) DATE/TIME OF LAST NPI CHANGE (#.01) DATE/TIME OF LAST NPI CHANGE [1D]
 S IBFDA(355.9301,"+1,"_IBIEN_",",.02)=1  ;(#.02) STATUS [2S]
 S IBFDA(355.9301,"+1,"_IBIEN_",",.03)=IBNPI  ;(#.03) NPI [3F]
 S IBFDA(355.9301,"+1,"_IBIEN_",",.04)=IBFBDUZ  ;(#.04)PERSON AFFECTING LAST CHANGE [4P:200]
 D UPDATE^DIE("","IBFDA","","IBERR")
 I $G(IBERR("DIERR"))'="" S IBQUIT=1
 Q 'IBQUIT
 ;
CHKTXY(IBIEN,IBPRVTXY)  ;LOOKS FOR TAXONOMY CODE AND MAKES ACTIVE OR ADDS
 ;
 ;INPUT : IBIEN  - THE IEN OF THE IB NON/OTHER VA BILLING PROVIDER BEING UDPATED
 ;        IBPRVTXY - THE TAXONOMY CODE PROVIDED BY FEE BASIS THAT IS BEING LOOKED FOR
 ;
 ; RETURNS: 
 ;                               '0' FOR NO TXY UPDATES ATTEMPTED;
 ;                               '1' FOR TXY CODE NOT FOUND IN 8932.1;
 ;                               '2' FOR MATCHED PRIMARY,NO UPDATES;
 ;                               '3' FOR MATCHED NON-PRIMARY, IB TXY UPDATES;
 ;                               '4' FOR NEW, IB TXY ENTRY CREATED;
 ;
 N IBDONE,IBERR,IBTXYIEN,IBRETRN,IBACTIV,IBTXYCOD,IBOK
 ;
 ;GET THE INTERNAL VALUE OF THIS TAXONOMY CODE
 S IBTXYIEN=$$FIND1^DIC(8932.1,"","X",IBPRVTXY,"G","","IBERR")  ;8932.1 PERSON CLASS FILE
 I (IBTXYIEN>0) D
 .S IBDONE=0
 .S IBPRIM=0
 .S IBTXY=0
 .F  S IBTXY=$O(^IBA(355.93,IBIEN,"TAXONOMY",IBTXY)) Q:(('+IBTXY)!IBDONE)  D
 ..S IBTXYCOD=$P(^IBA(355.93,IBIEN,"TAXONOMY",IBTXY,0),U,1)
 ..S IBPRIM=$P(^IBA(355.93,IBIEN,"TAXONOMY",IBTXY,0),U,2)
 ..S IBACTIV=$P(^IBA(355.93,IBIEN,"TAXONOMY",IBTXY,0),U,3)
 ..I IBTXYCOD=IBTXYIEN D
 ...S IBDONE=1
 ...S IBRETRN=2  ;'2' FOR MATCHED PRIMARY,NO UPDATES;
 ...I IBPRIM'=1 D
 ....S IBFDA(355.9342,IBTXY_","_IBIEN_",",".02")=1  ;355.9342 IB NON/OTHER VA BILLING PROVIDER FILE :TAXONOMY
 ....S IBFDA(355.9342,IBTXY_","_IBIEN_",",".03")="A"
 ....S IBRETRN=3  ;'3' FOR MATCHED NON-PRIMARY, IB TXY UPDATES;
 ....D FILE^DIE("","IBFDA","IBERR")
 .I 'IBDONE D
 ..S IBOK=$$ADDTXY(IBIEN,IBPRVTXY,1)
 ..S:IBOK IBRETRN=4 ; '4' FOR NEW IB TXY ENTRY CREATED
 ..S:'IBOK IBRETRN=0  ;'0' FOR NO UPDATES ATTEMPTED
 I (IBTXYIEN<=0) S IBRETRN=1   ;THIS CODE IS NOT A POINTER TO THE PERSON CLASS FILE - CAN'T ADD
 Q IBRETRN
 ;
ADDTXY(IBIEN,IBTXY,IBPRIM)  ;ADD TAXONOMY multiple entry
 ; INPUTS : IBIEN: IEN OF THE IB NON/OTHER VA PROVIDER FILE being updated with NPI information
 ;          IBTXY : TAXONOMY STRING TO BE ADDED if it passes validation rules
 ;          IBPRIM : 1 IF THIS IS TO BE ADDED AS PRIMARY CODE, 0 OTHERWISE
 ;
 ; RETURNS: 0 IF NO UDPATES WERE MADE TO TAXONOMY FILE
 ;          1 IF NEW TAXONOMY CODE WAS ADDED
 ;
 N IBFDA,IBFDAVAL,IBIENRET,IBERR,IBQUIT,IBOK
 ;
 S IBQUIT=0
 S IBFDA(355.9342,"?+1,"_IBIEN_",",.01)=IBTXY   ;355.9342  ;IB NON/OTHER VA BILLING PROVIDER FILE :TAXONOMY
 S IBFDA(355.9342,"?+1,"_IBIEN_",",.02)=IBPRIM
 S IBFDA(355.9342,"?+1,"_IBIEN_",",.03)="A"
 D VALS^DIE("","IBFDA","IBFDAVAL","IBERR")
 I $G(IBERR("DIERR"))'="" S IBQUIT=1
 I 'IBQUIT D 
 .D UPDATE^DIE("","IBFDAVAL","IBIENRET","IBERR")
 .I $G(IBERR("DIERR"))="" D
 ..S:$G(IBIENRET(1))'="" IBOK=IBIENRET(1)  ;THE IEN WHICH WAS JUST ADDED
 ..S:'+IBOK IBQUIT=1
 .I $G(IBERR("DIERR"))'="" S IBQUIT=1
 Q 'IBQUIT
 ;
ACTVNPI(IBNPI) ;RETURNS ien of ACTIVE NPI IN IB NON/OTHER VA BILLING PROVIDER FILE
 ;INPUT IBNPI : The NPI from FB provider under consideration
 N IBIEN,IBSUB
 S IBIEN=$O(^IBA(355.93,"NPIHISTORY",IBNPI,""),-1)  ;Most recent IEN for this NPI
 I $G(IBIEN)'="" D
 .S IBSUB=$O(^IBA(355.93,IBIEN,"NPISTATUS","C",IBNPI,""),-1)  ;MOST recent status for this IEN for this NPI
 .S:IBSUB="" IBIEN=""
 .Q:IBIEN=""
 .S:'$D(^IBA(355.93,IBIEN,"NPISTATUS","NPISTATUS",1,IBSUB)) IBIEN=""
 Q IBIEN
 ;
INACTV(IBNPI) ;RETURNS ien of INACTIVE NPI IN IB NON/OTHER VA BILLING PROVIDER FILE
 ;INPUT IBNPI : The NPI from FB provider under consideration
 N IBIEN,IBSUB
 S IBIEN=$O(^IBA(355.93,"NPIHISTORY",IBNPI,""),-1)
 I $G(IBIEN)'="" D
 .S IBSUB=$O(^IBA(355.93,IBIEN,"NPISTATUS","C",IBNPI,""),-1)  ;MOST recent status for this NPI
 .S:IBSUB="" IBIEN=""
 .Q:IBIEN=""
 .S:'$D(^IBA(355.93,IBIEN,"NPISTATUS","NPISTATUS",0,IBSUB)) IBIEN=""
 Q IBIEN
 ;
RULES(IBNPI) ;Verify that the NPI meets all rules for being added
 ; see NPIUSED^IBCEP81 where the input transform on the NPI field that is being bypassed is defined
 ; INPUT IBNPI - the NPI about to be added
 ;
 ; OUTPUT 0 if no ACTIVE records found 1 if ACTIVE in NEW PERSON FILE, 2 IF ACVTIVE IN INSTUTUTION FILE
 N IBIEN1,IBIEN2,IBRETURN
 ;
 S IBRETURN=0  ;NOT FOUND IN ANY FILES
 I IBNPI="" S IBRETURN=""
 S:+IBNPI&$D(^VA(200,"ANPI",IBNPI)) IBRETURN=1  ;ACTIVE in the NEW PERSON file
 S:+IBNPI&$D(^DIC(4,"ANPI",IBNPI)) IBRETURN=2   ;ACTIVE in the INSTITUTION file
 Q IBRETURN
 ;
FBALLOW(IBIEN)  ;Returns 1 if FB updates are allowed
 ; INPUT : IBIEN - The internal entry number to the IB NON/OTHER VA BILLING PROVIDER FILE
 ;
 N IBRETURN,IBSUB,IBERR
 ;
 S IBSUB=9999999
 S IBRETURN=1   ;ALLOW updates if no entry has been  made
 I $O(^IBA(355.93,IBIEN,2))=3 D
 .S IBSUB=$O(^IBA(355.93,IBIEN,3,IBSUB),-1)  ;get the most recent sub-entry
 .S IBRETURN=$$GET1^DIQ(355.9351,IBSUB_","_IBIEN_",",".02","I","","")
 .I IBRETURN'=0 S IBRETURN=1
 Q IBRETURN
 ;
STRIP(FBPRVNAM) ; Strip off leading and trailing spaces
 ;
 N IBPRVNAM
 ;
 S IBPRVNAM=FBPRVNAM
 F  Q:$E(IBPRVNAM)'=" "  S IBPRVNAM=$E(IBPRVNAM,2,$L(IBPRVNAM))
 F  Q:$E(IBPRVNAM,$L(IBPRVNAM))'=" "  S IBPRVNAM=$E(FBPRVNAM,1,$L(IBPRVNAM)-1)
 Q IBPRVNAM
 ;
SETIBFDA(IBRTRN,IBFBINF,IBFDA,IBIEN)  ;Populates IBFDA ARRAY with update information
 ; INPUT : IBRTRN - an array with current IB information in it
 ;         IBFBINF - an array with information from FB in it
 ;         IBFDA  - the array which will be used to update the record
 ;         IBIEN  - the IEN of the IB record being updated
 ; 
 ; OUTPUT : POPULATED IBFDA ARRAY IF UPDATES ARE NEEDED
 I IBFBINF("IB TYPE")=1 D
 .I IBRTRN(355.93,IBIEN_",",".01","I")=IBPRVNAM D
 ..I IBRTRN(355.93,IBIEN_",",".05","I")'=$G(IBFBINF("FBADD1")) S IBFDA(355.93,IBIEN_",",.05)=IBFBINF("FBADD1")
 ..I IBRTRN(355.93,IBIEN_",",".1","I")'=$G(IBFBINF("FBADD2")) S IBFDA(355.93,IBIEN_",",.1)=IBFBINF("FBADD2")
 ..I IBRTRN(355.93,IBIEN_",",".06","I")'=$G(IBFBINF("FBCITY")) S IBFDA(355.93,IBIEN_",",.06)=IBFBINF("FBCITY")
 ..I IBRTRN(355.93,IBIEN_",",".07","I")'=$G(IBFBINF("FBSTATE INT")) S IBFDA(355.93,IBIEN_",",.07)=IBFBINF("FBSTATE INT")
 ..I IBRTRN(355.93,IBIEN_",",".08","I")'=$G(IBFBINF("FBZIP")) S IBFDA(355.93,IBIEN_",",.08)=IBFBINF("FBZIP")
 ..I IBRTRN(355.93,IBIEN_",",".09","I")'=$G(IBFBINF("FBFACID")) S IBFDA(355.93,IBIEN_",",.09)=IBFBINF("FBFACID")
 .I (IBRTRN(355.93,IBIEN_",",".01","I")'=IBPRVNAM) D
 ..; When the name changes, everything is wiped out, so needs to be saved again
 ..S IBFDA(355.93,IBIEN_",",.01)=IBPRVNAM
 ..I $G(IBFBINF("FBADD1"))'="" S IBFDA(355.93,IBIEN_",",.05)=IBFBINF("FBADD1")
 ..I $G(IBFBINF("FBADD2"))'="" S IBFDA(355.93,IBIEN_",",.1)=IBFBINF("FBADD2")
 ..I $G(IBFBINF("FBCITY"))'="" S IBFDA(355.93,IBIEN_",",.06)=IBFBINF("FBCITY")
 ..I $G(IBFBINF("FBSTATE"))'="" S IBFDA(355.93,IBIEN_",",.07)=IBFBINF("FBSTATE INT")
 ..I $G(IBFBINF("FBZIP"))'="" S IBFDA(355.93,IBIEN_",",.08)=IBFBINF("FBZIP")
 ..I $G(IBFBINF("FBFACID"))'="" S IBFDA(355.93,IBIEN_",",.09)=IBFBINF("FBFACID")
 I IBFBINF("IB TYPE")=2 D
 .I (IBRTRN(355.93,IBIEN_",",".01","I")'=IBPRVNAM) S IBFDA(355.93,IBIEN_",",.01)=IBPRVNAM
 Q
 ;
LOCK(IBIEN) ;Locks the #355.93 file or a record in it
 ; INPUT : IBIEN - the ien of the record to be locked NULL if a  new record is being added
 N IBLOCK
 ;
 S IBLOCK=1
 I $G(IBIEN)="" D
 .L +^IBA(355.93):3
 .I '$T S IBLOCK=0
 I $G(IBIEN)'="" D
 .L +^IBA(355.93,IBIEN):3
 .I '$T S IBLOCK=0
 Q IBLOCK
 ;
UNLOCK(IBIEN)  ; Unlocks the #355.93 file or a record in it
 ; INPUT : IBIEN - the ien of the record to be unlocked or NULL if a new record was added
 I $G(IBIEN)="" L -^IBA(355.93)
 I $G(IBIEN)'="" L -^IBA(355.93,IBIEN)
 Q