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

A1B2T2.m

Go to the documentation of this file.
A1B2T2 ;ALB/EG EXTRACT FROM ODS FILES AND PUT IN MESSAGE 2 ; JAN 12 1991
 ;;Version 1.55 (local for MAS v5 sites);;
 K ^UTILITY("TRN1",$J) S KNT=2,K4=2,KNT1="",A1B2T2=1,A1B2FLAG=0
 F AI=1:1 S KNT1=$O(^UTILITY("TRN",$J,2,A1B2T2,KNT1)) Q:KNT1=""  S K3=$O(^UTILITY("TRN",$J,2,A1B2T2,KNT1,0)) I $D(^UTILITY("TRN",$J,2,A1B2T2,KNT1)) D PSET S KNT=KNT+1
 S KNT1="" F A1B2T2=2:1:8 F AI=1:1 S KNT1=$O(^UTILITY("TRN",$J,2,A1B2T2,KNT1)) Q:KNT1=""  I $D(^UTILITY("TRN",$J,2,A1B2T2,KNT1,0)) S ^UTILITY("TRN1",$J,2,KNT,0)=^UTILITY("TRN",$J,2,A1B2T2,KNT1,0),KNT=KNT+1
 I KNT>3 S ^UTILITY("TRN1",$J,2,KNT,0)="$END" D MSG1
 S K4=3,KNT=2,KNT1="",A1B2T2=1 F AI=1:1 S KNT1=$O(^UTILITY("TRN",$J,3,A1B2T2,KNT1)) Q:KNT1=""  S K3=$O(^UTILITY("TRN",$J,3,A1B2T2,KNT1,0)) I $D(^UTILITY("TRN",$J,3,A1B2T2,KNT1)) D PSET S KNT=KNT+1
 S KNT1="" F A1B2T2=2:1:8 F AI=1:1 S KNT1=$O(^UTILITY("TRN",$J,3,A1B2T2,KNT1)) Q:KNT1=""  I $D(^UTILITY("TRN",$J,3,A1B2T2,KNT1,0)) S ^UTILITY("TRN1",$J,3,KNT,0)=^UTILITY("TRN",$J,3,A1B2T2,KNT1,0),KNT=KNT+1
 I KNT>3 S ^UTILITY("TRN1",$J,3,KNT,0)="$END" D MSG2
END K ^UTILITY("TRN1",$J),A1B2DEST,A1B2FLAG,A1B2FN,A1B2MG,A1B2NET,A1B2NOW,A1B2T2,AI,AI1,AK,DGTOUT,K3,K4,KNT,KNT1,XMSUB,XMTEXT,XMY,XMZ
 Q
PSET S ^UTILITY("TRN1",$J,K4,KNT,0)=^UTILITY("TRN",$J,K4,A1B2T2,KNT1,K3,0)
 Q:KNT1=.5  S ^UTILITY("TRN1",$J,K4,KNT+1,0)=^UTILITY("TRN",$J,K4,A1B2T2,KNT1,K3+.5,0)
 S KNT=KNT+1
 Q
MSG1 ;new ods message (2)
 D ET S ^UTILITY("TRN1",$J,2,1,0)="$START"_U_2_U_KNT_U_A1B2NET_U_DGTOUT,XMSUB="ODS NEW from "_A1B2NET,XMTEXT="^UTILITY(""TRN1"","_$J_",2,"
 S XMY("G.ODS-SERVER@"_A1B2DEST)="" D SRV,^XMD K XMSUB,XMTEXT,XMY S A1B2FLAG=A1B2FLAG+1
 S A1B2TR=2 F FL=11500.1,11500.2,11500.3,11500.4,11500.61,11500.62,11500.63,11500.64 S A1B2DA="" F AI=1:1 S A1B2DA=$O(^UTILITY("TRN2",$J,A1B2TR,FL,A1B2DA)) Q:A1B2DA=""  D SENT
 K ^UTILITY("TRN2",$J,A1B2TR),A1B2DA,AI,A1B2TR,AI,FL
 Q
MSG2 ;correction ods message (3)
 D ET S ^UTILITY("TRN1",$J,3,1,0)="$START"_U_3_U_KNT_U_A1B2NET_U_DGTOUT,XMSUB="ODS CORRECTION from "_A1B2NET,XMTEXT="^UTILITY(""TRN1"","_$J_",3,"
 S XMY("G.ODS-SERVER@"_A1B2DEST)="" D SRV,^XMD K XMSUB,XMTEXT,XMY S A1B2FLAG=A1B2FLAG+10
 S A1B2TR=3 F FL=11500.1,11500.2,11500.3,11500.4,11500.61,11500.62,11500.63,11500.64 S A1B2DA="" F AI=1:1 S A1B2DA=$O(^UTILITY("TRN2",$J,A1B2TR,FL,A1B2DA)) Q:A1B2DA=""  D SENT
 K ^UTILITY("TRN2",$J,A1B2TR),A1B2DA,AI,A1B2TR,AI,FL
 Q
SENT ;set transmission flag
 S DIE=FL,DA=A1B2DA,DR="1.01///1;1.06////"_XMZ D ^DIE K DA,DIE,DR
 Q
NADA S %DT="ST",X="NOW" D ^%DT S A1B2NOW=Y,AJ=$S(A1B2FLAG=1:1,A1B2FLAG>9:2,1:9),A1B2FLAG=AJ
 S DIE=11500.5,DA=1,DLAYGO=11500.5,DR=".04////"_A1B2NOW_";.05///"_A1B2FLAG D ^DIE K DA,DIE,DR
 K AJ S AJ=$S(A1B2FLAG=1:2,A1B2FLAG=9:1,A1B2FLAG=2:3,1:1),A1B2FLAG=AJ,XMSUB="ODS STATUS from "_A1B2NET
 S AJ(1,0)="$START^9^1^"_A1B2NET_U_A1B2FN_U_A1B2FLAG,AJ(2,0)="$NADA^NO DATA TO TRANSMIT",XMTEXT="AJ(" D SRV,^XMD K %DT,AJ,XMSUB,XMTEXT,XMY
 Q
SRV ;address
 S AK=0,AJ="ODS CONFIRMATION",XMY("S.A1B2Z-SERVER@"_A1B2DEST)="",A1B2MG=$S('$D(^XMB(3.8,"B",AJ)):.5,1:$O(^XMB(3.8,"B",AJ,0)))
 I A1B2MG'=.5 F AI1=1:1 S AK=$O(^XMB(3.8,A1B2MG,1,AK)) Q:(AK="")!(AK'?.N)  S XMY(^XMB(3.8,A1B2MG,1,AK,0))=""
 Q
ET ;elapsed time for run
 Q:$D(H1)=0  S H2=$H D ET1 Q
 ;
ET1 ;H1-start time,H2-end time,DGTOUT-difference in seconds
 S H1(1)=$P(H1,",",1),H1(2)=$P(H1,",",2),H2(1)=$P(H2,",",1),H2(2)=$P(H2,",",2)
 I H1(1)=H2(1) S DGTOUT=H2(2)-H1(2) Q
 S DGTOUT=86400*(H2(1)-H1(1))+(H2(2)-H1(2)) Q