- AZAGMED ; IHS/PHXAO/TMJ - UNIX GENERIC FILE READER ; [ 06/11/03 4:11 PM ]
- ;1.0;BME MEDICAID UTILITIES;NOVEMBER 12, 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 - ^AZAGMED(
- ;The Routine ^AZAMED $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 AZAERROR=0
- S BEGTIME=0,ENDTIME=0,UNIXTIME=0
- D ^XBKVAR
- K ^AZAGMED
- D AZAG I AZAERROR=1 G END
- S BEGTIME=$$NOW^XLFDT
- D OPENAZAG
- D END
- S ENDTIME=$$NOW^XLFDT
- S UNIXTIME=ENDTIME-BEGTIME
- Q
- ;
- AZAG ; -- this sets up the device and sets the file name
- S AZALSTN="" ;Last Log IEN # for Last File processed
- S AZALSTNM="" ;Actual File Name in Log
- S AZALSTN=$P($G(^AZAMEDLG(0)),U,3)
- I AZALSTN="" G FIRST
- S AZALSTNM=$P($G(^AZAMEDLG(AZALSTN,0)),U,8)
- I AZALSTNM="" W !!,"Last File Name does NOT exist in Log. Contact Site Manager!" S AZAERROR=1 Q
- D PROCESS Q
- ;
- FIRST ;FILENAME FOR 1ST TIME RUN AT FACILTY - HARD CODED
- ;
- I AZALSTN="" S FILE="MED012001.TXT" D FIRST1 Q
- ;
- PROCESS ;Process file here
- S MM=$E(AZALSTNM,4,5) S YY=$E(AZALSTNM,6,9)
- S MM=MM+1 I MM>12 S YY=YY+1,MM="01"
- I $L(MM)=1 S MM="0"_MM
- S NEXTFDT=MM_YY
- S FILE="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
- ;
- ;
- OPENAZAG ; -- this uses the device and reads in the records from the file
- ;
- D OPEN^%ZISH("AHCCCS",PATH,FILE,"R")
- I POP U IO(0) W !,"Can't open Host File Server" Q
- U IO(0) W !,"Reading this file",!
- ;
- ;
- F AZAGI=1:1 D Q:$$STATUS^%ZISH
- .U IO R X Q:$$STATUS^%ZISH
- .S ^AZAGMED(AZAGI)=$E(X,1,420)
- Q
- END ; -- close the device here a kill variables
- S AZAGITOT=AZAGI-2
- ;W !,"Total Records Processed: "_AZAGITOT
- D ^%ZISC
- K AZAGI,%FN,AZAGPTR,AZAGX,PATH,X
- Q
- AZAGMED ; IHS/PHXAO/TMJ - UNIX GENERIC FILE READER ; [ 06/11/03 4:11 PM ]
- +1 ;1.0;BME MEDICAID UTILITIES;NOVEMBER 12, 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 - ^AZAGMED(
- +10 ;The Routine ^AZAMED $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 AZAERROR=0
- +2 SET BEGTIME=0
- SET ENDTIME=0
- SET UNIXTIME=0
- +3 DO ^XBKVAR
- +4 KILL ^AZAGMED
- +5 DO AZAG
- IF AZAERROR=1
- GOTO END
- +6 SET BEGTIME=$$NOW^XLFDT
- +7 DO OPENAZAG
- +8 DO END
- +9 SET ENDTIME=$$NOW^XLFDT
- +10 SET UNIXTIME=ENDTIME-BEGTIME
- +11 QUIT
- +12 ;
- AZAG ; -- this sets up the device and sets the file name
- +1 ;Last Log IEN # for Last File processed
- SET AZALSTN=""
- +2 ;Actual File Name in Log
- SET AZALSTNM=""
- +3 SET AZALSTN=$PIECE($GET(^AZAMEDLG(0)),U,3)
- +4 IF AZALSTN=""
- GOTO FIRST
- +5 SET AZALSTNM=$PIECE($GET(^AZAMEDLG(AZALSTN,0)),U,8)
- +6 IF AZALSTNM=""
- WRITE !!,"Last File Name does NOT exist in Log. Contact Site Manager!"
- SET AZAERROR=1
- QUIT
- +7 DO PROCESS
- QUIT
- +8 ;
- FIRST ;FILENAME FOR 1ST TIME RUN AT FACILTY - HARD CODED
- +1 ;
- +2 IF AZALSTN=""
- SET FILE="MED012001.TXT"
- DO FIRST1
- QUIT
- +3 ;
- PROCESS ;Process file here
- +1 SET MM=$EXTRACT(AZALSTNM,4,5)
- SET YY=$EXTRACT(AZALSTNM,6,9)
- +2 SET MM=MM+1
- IF MM>12
- SET YY=YY+1
- SET MM="01"
- +3 IF $LENGTH(MM)=1
- SET MM="0"_MM
- +4 SET NEXTFDT=MM_YY
- +5 SET FILE="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 ;
- OPENAZAG ; -- this uses the device and reads in the records from the file
- +1 ;
- +2 DO OPEN^%ZISH("AHCCCS",PATH,FILE,"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 AZAGI=1:1
- Begin DoDot:1
- +8 USE IO
- READ X
- IF $$STATUS^%ZISH
- QUIT
- +9 SET ^AZAGMED(AZAGI)=$EXTRACT(X,1,420)
- End DoDot:1
- IF $$STATUS^%ZISH
- QUIT
- +10 QUIT
- END ; -- close the device here a kill variables
- +1 SET AZAGITOT=AZAGI-2
- +2 ;W !,"Total Records Processed: "_AZAGITOT
- +3 DO ^%ZISC
- +4 KILL AZAGI,%FN,AZAGPTR,AZAGX,PATH,X
- +5 QUIT