DGBTSRCH ;ALB/SCK - SEARCH ROUTINE FOR INCOMPLETE DATA IN bt DISTANCE FILE;2/4/93 4/22/93
;;1.0;Beneficiary Travel;;September 25, 2001
Q
START ;
K DIR D HOME^%ZIS W @IOF
START2 ;
W !!!?5,"List the Incomplete data found in the Beneficiary Distance File",!?5,"Any incomplete data should be corrected as soon as possible"
S OPT=$$OPTION G:$D(DIRUT) EXIT
S OPT=$S(Y=1:"REMARKS",Y=2:"ZIP",Y=3:"MILES",1:"") G:OPT']"" EXIT
L +^DGBT(392.1):3 I '$T W !!?5,*7,"File not available, Please try later..." G EXIT
D @OPT L -^DGBT(392.1) G START2
EXIT ;
L -^DGBT(392.1)
K II,DIR,TO,FLDS,DHD,L,FR,OPT,X,Y,DR,DIRUT,DIS,DIC,BY,DA,DIS,DIOEND
Q
I $$REPORT=1 D
. K DIC S DIC="^DGBT(392.1,",DIC(0)="EMZ",L=0,BY="[DGBT REMARKS]",FLDS="[DGBT REMARKS]",DHD="Incomplete Additional Information Remarks in the Beneficiary Travel Distance FIle",DIOEND="D FTR^DGBTSRCH"
. D EN1^DIP K DIC
W !!,"Do you wish to update any Remark fields" Q:$$YESNO'=1
D SETUP S DIR(0)="FO^1:30" D ^DIR Q:$D(DIRUT) S X=Y K DIR D ^DIC Q:+Y'>0 S DA=+Y,DIE="^DGBT(392.1,",DR="100",DR(2,392.1001)="5" D ^DIE K DIE
G REMARK1
Q
ZIP ; list cities with missing zip codes, screen on fields that don't match 5N
I $$REPORT=1 D
. K DIC S DIC="^DGBT(392.1,",DIC(0)="EMZ",L=0,DIS(0)="I +$P($G(^DGBT(392.1,D0,0)),U,4)'>0",BY=".01",FLDS="[DGBT ZIP]",(FR,TO)=""
.S DHD="Incomplete zip code information in the Beneficiary Travel Distance File",DIOEND="D FTR^DGBTSRCH"
. D EN1^DIP K DIC
W !!,"Do you wish to update Zip Codes" Q:$$YESNO'=1
ZIP1 ; loop to add zip codes
D SETUP D ^DIR Q:$D(DIRUT) S X=Y K DIR D ^DIC Q:+Y'>0 S DA=+Y,DIE="^DGBT(392.1,",DR="[DGBT ZIP]" D ^DIE K DIE
G ZIP1
Q
MILES ; list those cities that have a null default mileage
I $$REPORT=1 D
. K DIC S DIC="^DGBT(392.1,",DIC(0)="EMZ",L=0,DIS(1)="I +$P($G(^DGBT(392.1,D0,0)),U,3)'>0",BY=".01",FLDS="[DGBT MILES]",(FR,TO)=""
. S DHD="Incomplete mileage information",DIOEND="D FTR^DGBTSRCH"
. D EN1^DIP K DIC
W !!,"Do you wish to update Mileage data" Q:$$YESNO'=1
MILES1 ; add/edit default mileage and division mileage
D SETUP D ^DIR Q:$D(DIRUT) S X=Y K DIR D ^DIC Q:+Y'>0 S DA=+Y,DIE="^DGBT(392.1,",DR="[DGBT MILES]" D ^DIE K DIE
G MILES1
Q
STCHK ;
S STREC="",DIE="^DGBT(392.1,",DR="2",STERR=0
F STREC=0:0 S STREC=$O(^DGBT(392.1,STREC)) Q:+STREC'>0 I $P($G(^DGBT(392.1,STREC,0)),U,2)']"" S STATE(STERR)=STREC,STERR=STERR+1
I STERR>0 W !!?5,*7,">> YOU HAVE ",STERR," ERROR(S) IN YOUR STATE IDENTIFIERS,",!?5,"THESE MUST BE CORRECTED BEFORE CONTINUING",! D
. F XX=0:1:STREC S DA=STATE(XX) W !,"City Name: ",$P($G(^DGBT(392.1,DA,0)),U,1)
. D ^DIE
K DIE,STATE,STREC,STERR,XX
Q
YESNO() ;
YN1 S %=2 D YN^DICN I %=0 W !,"Enter either YES or NO, '^' to Exit." G YN1
Q (+%)
SETUP ; setup common variables for lookup and edit
S DIC="^DGBT(392.1,",(FR,TO)="",L=0,DIC(0)="EMZ",DIR(0)="FO^1:30",DIR("A")="ENTER NAME OF CITY TO CORRECT"
S DIR("?")="Enter the name of the city you wish to lookup, 1 to 30 characters in length"
Q
OPTION() ; menu options in text form.
S X="SO^"
S X=X_"1:Additional Information Fields Marked;"
S X=X_"2:Missing Zip Codes;"
S X=X_"3:No Default or Division Mileages"
S DIR(0)=X,DIR("A")="Enter Option or [RETURN] to continue",DIR("?")="Enter the desired menu option mumber or either '^' or [RETURN] to add departure city"
D ^DIR K DIR
Q (+Y)
REPORT() ; ask yes no to do report
W !!?5,"Print Report"
RP1 S %=1 D YN^DICN I %=0 W !?5,"Enter 'Y'es or 'N'o" G RP1
Q (+%)
;
FTR ;
W !!?5,"NOTE:",!?5,"If no data prints, then no problems were found"
W !?5,"in the Distance file.",!
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGBTSRCH 3760 printed Nov 22, 2024@16:51:20 Page 2
DGBTSRCH ;ALB/SCK - SEARCH ROUTINE FOR INCOMPLETE DATA IN bt DISTANCE FILE;2/4/93 4/22/93
+1 ;;1.0;Beneficiary Travel;;September 25, 2001
+2 QUIT
START ;
+1 KILL DIR
DO HOME^%ZIS
WRITE @IOF
START2 ;
+1 WRITE !!!?5,"List the Incomplete data found in the Beneficiary Distance File",!?5,"Any incomplete data should be corrected as soon as possible"
+2 SET OPT=$$OPTION
if $DATA(DIRUT)
GOTO EXIT
+3 SET OPT=$SELECT(Y=1:"REMARKS",Y=2:"ZIP",Y=3:"MILES",1:"")
if OPT']""
GOTO EXIT
+4 LOCK +^DGBT(392.1):3
IF '$TEST
WRITE !!?5,*7,"File not available, Please try later..."
GOTO EXIT
+5 DO @OPT
LOCK -^DGBT(392.1)
GOTO START2
EXIT ;
+1 LOCK -^DGBT(392.1)
+2 KILL II,DIR,TO,FLDS,DHD,L,FR,OPT,X,Y,DR,DIRUT,DIS,DIC,BY,DA,DIS,DIOEND
+3 QUIT
+1 IF $$REPORT=1
Begin DoDot:1
+2 KILL DIC
SET DIC="^DGBT(392.1,"
SET DIC(0)="EMZ"
SET L=0
SET BY="[DGBT REMARKS]"
SET FLDS="[DGBT REMARKS]"
SET DHD="Incomplete Additional Information Remarks in the Beneficiary Travel Distance FIle"
SET DIOEND="D FTR^DGBTSRCH"
+3 DO EN1^DIP
KILL DIC
End DoDot:1
+4 WRITE !!,"Do you wish to update any Remark fields"
if $$YESNO'=1
QUIT
+1 DO SETUP
SET DIR(0)="FO^1:30"
DO ^DIR
if $DATA(DIRUT)
QUIT
SET X=Y
KILL DIR
DO ^DIC
if +Y'>0
QUIT
SET DA=+Y
SET DIE="^DGBT(392.1,"
SET DR="100"
SET DR(2,392.1001)="5"
DO ^DIE
KILL DIE
+2 GOTO REMARK1
+3 QUIT
ZIP ; list cities with missing zip codes, screen on fields that don't match 5N
+1 IF $$REPORT=1
Begin DoDot:1
+2 KILL DIC
SET DIC="^DGBT(392.1,"
SET DIC(0)="EMZ"
SET L=0
SET DIS(0)="I +$P($G(^DGBT(392.1,D0,0)),U,4)'>0"
SET BY=".01"
SET FLDS="[DGBT ZIP]"
SET (FR,TO)=""
+3 SET DHD="Incomplete zip code information in the Beneficiary Travel Distance File"
SET DIOEND="D FTR^DGBTSRCH"
+4 DO EN1^DIP
KILL DIC
End DoDot:1
+5 WRITE !!,"Do you wish to update Zip Codes"
if $$YESNO'=1
QUIT
ZIP1 ; loop to add zip codes
+1 DO SETUP
DO ^DIR
if $DATA(DIRUT)
QUIT
SET X=Y
KILL DIR
DO ^DIC
if +Y'>0
QUIT
SET DA=+Y
SET DIE="^DGBT(392.1,"
SET DR="[DGBT ZIP]"
DO ^DIE
KILL DIE
+2 GOTO ZIP1
+3 QUIT
MILES ; list those cities that have a null default mileage
+1 IF $$REPORT=1
Begin DoDot:1
+2 KILL DIC
SET DIC="^DGBT(392.1,"
SET DIC(0)="EMZ"
SET L=0
SET DIS(1)="I +$P($G(^DGBT(392.1,D0,0)),U,3)'>0"
SET BY=".01"
SET FLDS="[DGBT MILES]"
SET (FR,TO)=""
+3 SET DHD="Incomplete mileage information"
SET DIOEND="D FTR^DGBTSRCH"
+4 DO EN1^DIP
KILL DIC
End DoDot:1
+5 WRITE !!,"Do you wish to update Mileage data"
if $$YESNO'=1
QUIT
MILES1 ; add/edit default mileage and division mileage
+1 DO SETUP
DO ^DIR
if $DATA(DIRUT)
QUIT
SET X=Y
KILL DIR
DO ^DIC
if +Y'>0
QUIT
SET DA=+Y
SET DIE="^DGBT(392.1,"
SET DR="[DGBT MILES]"
DO ^DIE
KILL DIE
+2 GOTO MILES1
+3 QUIT
STCHK ;
+1 SET STREC=""
SET DIE="^DGBT(392.1,"
SET DR="2"
SET STERR=0
+2 FOR STREC=0:0
SET STREC=$ORDER(^DGBT(392.1,STREC))
if +STREC'>0
QUIT
IF $PIECE($GET(^DGBT(392.1,STREC,0)),U,2)']""
SET STATE(STERR)=STREC
SET STERR=STERR+1
+3 IF STERR>0
WRITE !!?5,*7,">> YOU HAVE ",STERR," ERROR(S) IN YOUR STATE IDENTIFIERS,",!?5,"THESE MUST BE CORRECTED BEFORE CONTINUING",!
Begin DoDot:1
+4 FOR XX=0:1:STREC
SET DA=STATE(XX)
WRITE !,"City Name: ",$PIECE($GET(^DGBT(392.1,DA,0)),U,1)
+5 DO ^DIE
End DoDot:1
+6 KILL DIE,STATE,STREC,STERR,XX
+7 QUIT
YESNO() ;
YN1 SET %=2
DO YN^DICN
IF %=0
WRITE !,"Enter either YES or NO, '^' to Exit."
GOTO YN1
+1 QUIT (+%)
SETUP ; setup common variables for lookup and edit
+1 SET DIC="^DGBT(392.1,"
SET (FR,TO)=""
SET L=0
SET DIC(0)="EMZ"
SET DIR(0)="FO^1:30"
SET DIR("A")="ENTER NAME OF CITY TO CORRECT"
+2 SET DIR("?")="Enter the name of the city you wish to lookup, 1 to 30 characters in length"
+3 QUIT
OPTION() ; menu options in text form.
+1 SET X="SO^"
+2 SET X=X_"1:Additional Information Fields Marked;"
+3 SET X=X_"2:Missing Zip Codes;"
+4 SET X=X_"3:No Default or Division Mileages"
+5 SET DIR(0)=X
SET DIR("A")="Enter Option or [RETURN] to continue"
SET DIR("?")="Enter the desired menu option mumber or either '^' or [RETURN] to add departure city"
+6 DO ^DIR
KILL DIR
+7 QUIT (+Y)
REPORT() ; ask yes no to do report
+1 WRITE !!?5,"Print Report"
RP1 SET %=1
DO YN^DICN
IF %=0
WRITE !?5,"Enter 'Y'es or 'N'o"
GOTO RP1
+1 QUIT (+%)
+2 ;
FTR ;
+1 WRITE !!?5,"NOTE:",!?5,"If no data prints, then no problems were found"
+2 WRITE !?5,"in the Distance file.",!
+3 QUIT