- BMEGMED ; IHS/PHXAO/TMJ - UNIX GENERIC FILE READER ;
- ;;1.0T1;MEDICAID ELIGIBILITY DOWNLOAD;;JUN 25, 2003
- ;
- ;
- ;This Reader Routine works on Cache, NT, or Unix
- ;It Calls OPEN^%ZISH to read file
- ;It Call STATUS^%ZISH to quit at End of File
- ;
- ;This Routine Reads the AHCCCS Medicaid Eligibility Roster Unix File
- ;Then sets a Monthly Temporary Global - ^BMEGMED(
- ;The Routine ^BMEMED $ORDERS through this Global and Populates
- ;The Monthly Temporary No Match File, the RPMS Master File, and
- ;The RPMS MEDICAID ELIGIBILITY FILE
- ;
- MAIN ; -- this is the main program loop
- S BMEERROR=0
- S BMEBTIME=0,BMEETIME=0,BMEUTIME=0
- D ^XBKVAR
- K ^BMEGMED
- D BMEG I BMEERROR=1 G END
- S BMEBTIME=$$NOW^XLFDT
- D OPENBMEG
- D END
- S BMEETIME=$$NOW^XLFDT
- S BMEUTIME=BMEETIME-BMEBTIME
- Q
- ;
- BMEG ; -- this sets up the device and sets the file name
- S BMELSTN="" ;Last Log IEN # for Last File processed
- S BMELSTNM="" ;Actual File Name in Log
- S BMELSTN=$P($G(^BMEMEDLG(0)),U,3)
- I BMELSTN="" G FIRST
- S BMELSTNM=$P($G(^BMEMEDLG(BMELSTN,0)),U,8)
- I BMELSTNM="" W !!,"Last File Name does NOT exist in Log. Contact Site Manager!" S BMEERROR=1 Q
- D PROCESS Q
- ;
- FIRST ;FILENAME FOR 1ST TIME RUN AT FACILTY - HARD CODED
- ;
- I BMELSTN="" S BMEFILE="MED062003.TXT" D FIRST1 Q
- ;
- PROCESS ;Process file here
- S BMEMM=$E(BMELSTNM,4,5) S BMEYY=$E(BMELSTNM,6,9)
- S BMEMM=BMEMM+1 I BMEMM>12 S BMEYY=BMEYY+1,BMEMM="01"
- I $L(BMEMM)=1 S BMEMM="0"_BMEMM
- S NEXTFDT=BMEMM_BMEYY
- S BMEFILE="MED"_NEXTFDT_".TXT"
- ;Q
- ;
- FIRST1 ;Called from First
- S PATH="c:\inetpub\ftproot\pub\" ;**Hard Code this line at each Site NT or Unix**
- ;
- Q
- ;
- ;
- OPENBMEG ; -- this uses the device and reads in the records from the file
- ;
- D OPEN^%ZISH("AHCCCS",PATH,BMEFILE,"R")
- I POP U IO(0) W !,"Can't open Host File Server" Q
- U IO(0) W !,"Reading this file",!
- ;
- ;
- F BMEGI=1:1 D Q:$$STATUS^%ZISH
- .U IO R X Q:$$STATUS^%ZISH
- .Q:"01^XX"'[$E(X,1,2) ;*** TESTING - AEF *** 3031002 - QUIT IF NOT A DATA RECORD
- .S ^BMEGMED(BMEGI)=$E(X,1,420)
- Q
- END ; -- close the device here a kill variables
- S BMEGITOT=BMEGI-2
- ;W !,"Total Records Processed: "_BMEGITOT
- D ^%ZISC
- K BMEGI,%FN,BMEGPTR,BMEGX,PATH,X
- Q
- BMEGMED ; IHS/PHXAO/TMJ - UNIX GENERIC FILE READER ;
- +1 ;;1.0T1;MEDICAID ELIGIBILITY DOWNLOAD;;JUN 25, 2003
- +2 ;
- +3 ;
- +4 ;This Reader Routine works on Cache, NT, or Unix
- +5 ;It Calls OPEN^%ZISH to read file
- +6 ;It Call STATUS^%ZISH to quit at End of File
- +7 ;
- +8 ;This Routine Reads the AHCCCS Medicaid Eligibility Roster Unix File
- +9 ;Then sets a Monthly Temporary Global - ^BMEGMED(
- +10 ;The Routine ^BMEMED $ORDERS through this Global and Populates
- +11 ;The Monthly Temporary No Match File, the RPMS Master File, and
- +12 ;The RPMS MEDICAID ELIGIBILITY FILE
- +13 ;
- MAIN ; -- this is the main program loop
- +1 SET BMEERROR=0
- +2 SET BMEBTIME=0
- SET BMEETIME=0
- SET BMEUTIME=0
- +3 DO ^XBKVAR
- +4 KILL ^BMEGMED
- +5 DO BMEG
- IF BMEERROR=1
- GOTO END
- +6 SET BMEBTIME=$$NOW^XLFDT
- +7 DO OPENBMEG
- +8 DO END
- +9 SET BMEETIME=$$NOW^XLFDT
- +10 SET BMEUTIME=BMEETIME-BMEBTIME
- +11 QUIT
- +12 ;
- BMEG ; -- this sets up the device and sets the file name
- +1 ;Last Log IEN # for Last File processed
- SET BMELSTN=""
- +2 ;Actual File Name in Log
- SET BMELSTNM=""
- +3 SET BMELSTN=$PIECE($GET(^BMEMEDLG(0)),U,3)
- +4 IF BMELSTN=""
- GOTO FIRST
- +5 SET BMELSTNM=$PIECE($GET(^BMEMEDLG(BMELSTN,0)),U,8)
- +6 IF BMELSTNM=""
- WRITE !!,"Last File Name does NOT exist in Log. Contact Site Manager!"
- SET BMEERROR=1
- QUIT
- +7 DO PROCESS
- QUIT
- +8 ;
- FIRST ;FILENAME FOR 1ST TIME RUN AT FACILTY - HARD CODED
- +1 ;
- +2 IF BMELSTN=""
- SET BMEFILE="MED062003.TXT"
- DO FIRST1
- QUIT
- +3 ;
- PROCESS ;Process file here
- +1 SET BMEMM=$EXTRACT(BMELSTNM,4,5)
- SET BMEYY=$EXTRACT(BMELSTNM,6,9)
- +2 SET BMEMM=BMEMM+1
- IF BMEMM>12
- SET BMEYY=BMEYY+1
- SET BMEMM="01"
- +3 IF $LENGTH(BMEMM)=1
- SET BMEMM="0"_BMEMM
- +4 SET NEXTFDT=BMEMM_BMEYY
- +5 SET BMEFILE="MED"_NEXTFDT_".TXT"
- +6 ;Q
- +7 ;
- FIRST1 ;Called from First
- +1 ;**Hard Code this line at each Site NT or Unix**
- SET PATH="c:\inetpub\ftproot\pub\"
- +2 ;
- +3 QUIT
- +4 ;
- +5 ;
- OPENBMEG ; -- this uses the device and reads in the records from the file
- +1 ;
- +2 DO OPEN^%ZISH("AHCCCS",PATH,BMEFILE,"R")
- +3 IF POP
- USE IO(0)
- WRITE !,"Can't open Host File Server"
- QUIT
- +4 USE IO(0)
- WRITE !,"Reading this file",!
- +5 ;
- +6 ;
- +7 FOR BMEGI=1:1
- Begin DoDot:1
- +8 USE IO
- READ X
- IF $$STATUS^%ZISH
- QUIT
- +9 ;*** TESTING - AEF *** 3031002 - QUIT IF NOT A DATA RECORD
- IF "01^XX"'[$EXTRACT(X,1,2)
- QUIT
- +10 SET ^BMEGMED(BMEGI)=$EXTRACT(X,1,420)
- End DoDot:1
- IF $$STATUS^%ZISH
- QUIT
- +11 QUIT
- END ; -- close the device here a kill variables
- +1 SET BMEGITOT=BMEGI-2
- +2 ;W !,"Total Records Processed: "_BMEGITOT
- +3 DO ^%ZISC
- +4 KILL BMEGI,%FN,BMEGPTR,BMEGX,PATH,X
- +5 QUIT