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

AFSLLDO2.m

Go to the documentation of this file.
AFSLLDO2 ;IHS/OIRM/DSD/JDM,HJT - LOAD ODF FROM DOWNLOAD FILE;   [ 10/27/2004   4:21 PM ]
 ;;3.0t1;1166 APPROVALS FOR PAYMENT;**1,13**;JAN 31, 1999
 ;;ACR*2.1*9   MODIFIED FOR CACHE' COMPLIANCE
 ;Modified for Y2k compliance   IHS/DSD/HJT   1/15/1999
 ;Read & check records from H.A.S. download file
FRD D ^XBCLS
 W !,"READY TO IMPORT SELECTED DOWNLOAD FILE."
 W !!,"Some Area Offices make obligations/payments for multiple accounting points."
 W !,"I must CLEAR the local obligations database before importing the 1ST",!,"Accounting Point download file ONLY."
 W !!,@AFSLRVON,"***WARNING!  ANSWERING ""Y"" TO THE NEXT QUESTION WILL CLEAR THE DATABASE.",@AFSLRVOF,*7
 N DIR,X,Y                                      ; ACR*2.1*13.02 IM13574
 S DIR(0)="Y^A"                                 ; ACR*2.1*13.02 IM13574
 S DIR("A")="IS THIS THE 1ST ACCOUNTING POINT (OF THIS DOWNLOAD) TO BE IMPORTED? (Y/N/^)" ; ACR*2.1*13.02 IM13574
 S DIR("B")="N"                                 ; ACR*2.1*13.02 IM13574
 D DIR^ACRFDIC                                   ; ACR*2.1*13.02 IM13574
 S AFSLAPIN=$S(ACRY=1:"Y",1:"N")                 ; ACR*2.1*13.02 IM13574
 N DIR,X,Y                                      ; ACR*2.1*13.02 IM13574
 S DIR(0)="Y^A"                                 ; ACR*2.1*13.02 IM13574
 S DIR("A")="ENTER ""Y"" AGAIN TO BEGIN (Y/N)"   ; ACR*2.1*13.02 IM13574
 S DIR("B")="N"                                 ; ACR*2.1*13.02 IM13574
 D DIR^ACRFDIC                                   ; ACR*2.1*13.02 IM13574
 S AFSLCONT=$S(ACRY=1:"Y",1:"N")  ;AFSLCONT IS EXPECTED TO BE Y OR N
 I AFSLCONT="N"!($D(ACRQUIT))!($D(ACROUT)) Q     ; ACR*2.1*13.02 IM13574
 D ^XBCLS
 S %FN=AFSEXFN,%IN=1 S (AFSLXY,AFSLXZ)="",AFSLDUP=0,AFSLZROS="000000000000",AFSLDUPF=""
 W !,"LOADING RECORDS FOR A/P ",AFSLAPN,!,"WORKING "
 I AFSLAPIN'="Y"&(AFSLAPIN'="y") G SKPCLR
 K ^AFSLODOC,^AFSLREJT ;EXEMPTION ************** H.A.S. DOWNLOAD GBLS
 S ^AFSLODOC(0)="1166 AFP OPEN DOCUMENTS^9002325.3^0^0",^AFSLREJT(0)="1166 AFP REJECTED HAS RCDS^9002325.7^0^0"
SKPCLR ;
 I '$D(X) S X="000"
 S AFSLWCTR=0
 D OPENHFS^AFSLCK1                               ; ACR*2.1*13.02 IM13574
 ;S IO=%DEV                                      ; ACR*2.1*13.02 IM13574
 F AFSLI=1:1 S AFSLWCTR=AFSLWCTR+1 U IO R X:60 D ^AFSLCKZC Q:X=""  Q:AFSLNZC=-1  D CHKS D:AFSLDUP=1 @(AFSLEMSG) I AFSLWCTR=1000 U IO(0) W "." S AFSLWCTR=0
 U IO(0) W AFSLI K AFSLWCTR
 U IO(0) W !!,"BEGINNING COMPILED RE-CROSSREFERENCING.  PLEASE WAIT WHILE FILEMAN REINDEXES.",!,"BEGIN: " D NOW^%DTC,YX^%DTC W Y
 S DIK="^AFSLODOC(" D IXALL^DIK
 U IO(0) W !?58,"END: " D NOW^%DTC,YX^%DTC W Y
 L -^AFSLODOC
 ;D ^%ZISC                                       ; ACR*2.1*13.02 IM13574
 D CLOSE^%ZISH("")                               ; ACR*2.1*13.02 IM13574
 D VARKIL K %FN,%IN,AFSLXY,AFSLXZ,AFSLXZ2,%DEV
 K AFSEXFN,AFSLCMD,AFSLCONT,AFSLDNOD,AFSLDNXT,AFSLDOCX,AFSLDT,AFSLDUP,AFSLDUPV,AFSLFFND,AFSLFY,AFSLI,AFSLLTDL,AFSLLTH,AFSLLTR
 K AFSLOBLD,AFSLOK,AFSLSN,AFSLSNX,AFSLVAL,AFSLXC,AFSLXFND,AFSLXY2,AFSLYNOD,AFSLYNXT,AFSLZROS,AFSLRVOF,AFSLRVON,DIK,DX,DY,I,K,X,XY
 Q
CHKS ;
 S X=$E(X,1,132)
 I $E(X,4)="J" S X=$E(X,2,132)
 Q:$E(X,1,2)'=AFSLAPN
 U IO(0) L +^AFSLODOC:15 I '$T S AFSLDUPF=1 W !,"FILE IN USE AT THIS TIME. TRY LATER." H 3 Q
 S AFSLDUP=0,AFSLEMSG="",AFSLOFLG=0,AFSLCFLG=0
 S AFSLFY=$E(X,43,44),AFSLDOC=$E(X,17,26),AFSLCAN=$E(X,27,33),AFSLOBJ=$E(X,34,37),AFSLDREF=$E(X,14,16),AFSLLCD=$E(X,125,127),AFSLOBDT=$E(X,39,44)
 S AFSLIMN=$E(X,4,6),AFSLCRDT=$E(X,45,50),AFSLLADT=$E(X,51,56),AFSLACRL=$E(X,99,111),AFSLDSBT=$E(X,112,124)
 I AFSLFY'?2N S AFSLEMSG=5 G CHKEND
 I AFSLDOC="          " S AFSLEMSG=6 G CHKEND
 I AFSLCAN'?1UN2N4UN S AFSLEMSG=12 G CHKEND
 I $E(AFSLCAN,2,3)'=AFSLAPN S AFSLEMSG=12 G CHKEND
 I AFSLOBJ[" " S AFSLEMSG=8 G CHKEND
 I AFSLLCD="   " S AFSLLCD="000"
 I AFSLLCD?1" "2N S AFSLLCD="0"_$E(AFSLLCD,2,3)
 I AFSLLCD?1"  "1N S AFSLLCD="00"_$E(AFSLLCD,3)
 I AFSLLCD?1N1"  " S AFSLLCD="00"_$E(AFSLLCD,1)
 I AFSLLCD?2N1" " S AFSLLCD="0"_$E(AFSLLCD,1,2)
 I AFSLLCD'?3E S AFSLEMSG=9 G CHKEND
CHKSX ;
 I AFSLOBDT'?6N S AFSLEMSG=10 G CHKEND
 I AFSLDREF'?3N S AFSLEMSG=11 G CHKEND
 ;Begin Y2k fix   HJT1/15/1999
 ;  Var AFSLFY must be converted to a 4-digit date before looking up
 ;  in glob ^AFSLODOC("B"..).  The subscript is 4 digits (i.e. 1999)
 S XSAVEX=X ;ACR*2.0T1*1
 S X=AFSLFY D ^%DT S AFSLFY=Y\10000+1700   ;Y2000
 S X=XSAVEX ;ACR*2.0T1*1
 ;End Y2k fix
 I $D(^AFSLODOC("B",AFSLFY)) S AFSLFYN=$O(^AFSLODOC("B",AFSLFY,0))
 E  S AFSLDUP=0 G CHKEND
 I $D(^AFSLODOC(AFSLFYN,1,"B",AFSLDOC)) S AFSLDOCN=$O(^AFSLODOC(AFSLFYN,1,"B",AFSLDOC,0))
 E  S AFSLDUP=0 G CHKEND
 I $D(^AFSLODOC("C",AFSLCAN,AFSLFYN,AFSLDOCN)) S AFSLCFLG=1
 E  S AFSLDUP=0 G CHKEND
 I $D(^AFSLODOC("D",AFSLOBJ,AFSLFYN,AFSLDOCN)) S AFSLOFLG=1,AFSLDUP=1,AFSLEMSG=1
CHKEND ;
 I AFSLEMSG=5 D @(AFSLEMSG),VARKIL Q  ;OBLIG.YR ERROR
 I AFSLEMSG=6 D @(AFSLEMSG),VARKIL Q  ;DOC# ERROR
 I AFSLEMSG=8 D @(AFSLEMSG),VARKIL Q  ;OBJ CLASS ERROR
 I AFSLEMSG=9 D @(AFSLEMSG),VARKIL Q  ;LOC CODE ERROR
 I AFSLEMSG=10 D @(AFSLEMSG),VARKIL Q  ;OBLIG.DT ERROR
 I AFSLEMSG=11 D @(AFSLEMSG),VARKIL Q  ;DOC REF ERROR
 I AFSLEMSG=12 D @(AFSLEMSG),VARKIL Q  ;CAN NUM ERROR
 I AFSLDUP'=1 D ^AFSLLDO3,VARKIL ;IF NOT DUPLICATE, DO ROUT TO SAVE RCD
 I AFSLDUP=1 D @(AFSLEMSG),VARKIL
 Q
EMSG ;ERROR MESSAGES
1 W !!,"DUPLICATE ENTRY! DOC.# "_$E(X,17,26)_" ALREADY EXISTS YOU CANNOT CREATE A DUPLICATE." D NOSAV S AFSLDUP=0 K AFSLEMSG Q
3 W !!,"CHS FI PAYMENT!  DOC.# "_$P(AFSLXZ,U,1)_" CANNOT BE ENTERED INTO THE 1166 DOCUMENTS FILE." D NOSAV K AFSLEMSG Q
5 W !!,"OBLIGATION YR FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
6 W !!,"DOCUMENT NO. FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
7 W !!,"RECORD# ",AFSLI," DOC# ",$P(AFSLXZ,U,1)," NOT SAVED (CLOSED & AGE>",AFSLPY," YRS." D NOSAV K AFSLEMSG Q
8 W !!,"OBJECT CLASS FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
9 W !!,"LOCATION CODE FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
10 W !!,"OBLIGATION DT FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
11 W !!,"DOC.REF. CODE FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
12 W !!,"CAN NUMBER FORMAT ERROR ON RECORD# "_AFSLI D NOSAV K AFSLEMSG Q
VARKIL ;
 K DIE,DR,DA,AFSLEMSG,AFSLOFLG,AFSLCFLG,AFSLDOC
 K AFSLCAN,AFSLOBJ,AFSLFYN,AFSLDOCN,AFSLYY,AFSLDDAT,AFSLFNUM
 S (AFSLXY,AFSLXY2,AFSLXZ)=""
 Q
NOSAV ;
 I K=0 S ^AFSLREJT(K)="1166 AFP REJECTED HAS RCDS^9002325.7^0^0"
 S K=K+1,$P(^AFSLREJT(0),U,3)=K,$P(^AFSLREJT(0),U,4)=K,$P(^AFSLREJT(K,0),U,1)=K
 I AFSLEMSG=5 S $P(^AFSLREJT(K,0),U,2)=$E(X,1,52)_"^"_AFSLEMSG_"^"_AFSLI,^AFSLREJT("B",K,K)="" Q
 S $P(^AFSLREJT(K,0),U,2)=$E(X,14,16)_"  "_$E(X,17,26)_"  "_$E(X,27,33)_"  "_$E(X,34,37)_"  "_$E(X,39,44)_"  "_$E(X,60,73)_"^"_AFSLEMSG_"^"_AFSLI
 S ^AFSLREJT("B",K,K)=""
 Q