DVBAREG3 ;ALB/JLU;continuation of DVBAREG2 and DVBAREG1
 ;;2.7;AMIE;;Apr 10, 1995
 ;
DOC(ANS) ;returns a document type.
 ;the return will either be a "A" for admission or "L"
 S ANS=$S(^TMP("DVBA",$J,ANS)["ADMISSION":"A",1:"L")
 Q ANS
 ;
PAT() ;this is a function call to look up the patient
 N STOP
 S DIC="^DPT(",DIC(0)="AEMQZ",DIC("A")="Enter Patient name: "
 K DIC("W")
 D ^DIC
 I $D(DTOUT)!($D(DUOUT))!(X="") S STOP=0
 E  S STOP=Y
 Q STOP
 ;
SET1 ;sets more variables
 S (ONFILE,REOPEN,ARROWOUT,OUT)=0
 Q
 ;
SET2 ;sets the patient information variables
 S PNAM=$P(DFN,U,2),SSN=$P(^DPT(+DFN,0),U,9)
 S CNUM=$S($D(^DPT(+DFN,.31)):$P(^(.31),U,3),1:"Unknown")
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBAREG3   689     printed  Sep 23, 2025@19:18:01                                                                                                                                                                                                     Page 2
DVBAREG3  ;ALB/JLU;continuation of DVBAREG2 and DVBAREG1
 +1       ;;2.7;AMIE;;Apr 10, 1995
 +2       ;
DOC(ANS)  ;returns a document type.
 +1       ;the return will either be a "A" for admission or "L"
 +2        SET ANS=$SELECT(^TMP("DVBA",$JOB,ANS)["ADMISSION":"A",1:"L")
 +3        QUIT ANS
 +4       ;
PAT()     ;this is a function call to look up the patient
 +1        NEW STOP
 +2        SET DIC="^DPT("
           SET DIC(0)="AEMQZ"
           SET DIC("A")="Enter Patient name: "
 +3        KILL DIC("W")
 +4        DO ^DIC
 +5        IF $DATA(DTOUT)!($DATA(DUOUT))!(X="")
               SET STOP=0
 +6       IF '$TEST
               SET STOP=Y
 +7        QUIT STOP
 +8       ;
SET1      ;sets more variables
 +1        SET (ONFILE,REOPEN,ARROWOUT,OUT)=0
 +2        QUIT 
 +3       ;
SET2      ;sets the patient information variables
 +1        SET PNAM=$PIECE(DFN,U,2)
           SET SSN=$PIECE(^DPT(+DFN,0),U,9)
 +2        SET CNUM=$SELECT($DATA(^DPT(+DFN,.31)):$PIECE(^(.31),U,3),1:"Unknown")
 +3        QUIT