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

ASUWSND1.m

Go to the documentation of this file.
ASUWSND1 ; IHS/ITSC/LMH - SAMS DATA TRANSMISSION ROUTINE - SEND DATA ; 
 ;;4.2T2;Supply Accounting Mgmt. System;;JUN 30, 2000
 ;;Y2K/OK AEF/2970903
 ;
 ;THIS ROUTINE IS UNDER DEVELOPMENT
 ;This routine is used by SAMS to transmit data from sites to the
 ;national repository database
 ;
EN ;EP -- MAIN ENTRY POINT TO TRANSMIT NEW SAMS TRANSACTIONS
 ;
 N ASUTRANS,ASUXMZ,X,Y
 D ^XBKVAR
 Q:'$D(^ASUW(9002036.88,"ATRANS",1))
 D TRANS(.ASUTRANS)
 Q:ASUTRANS'>0
 D MSG(.ASUXMZ,ASUTRANS)
 Q:ASUXMZ'>0
 D GET(ASUXMZ)
 D SEND(ASUXMZ)
 D MARK(ASUTRANS)
 G QUIT
 Q
EN2 ;EP -- ENTRY POINT TO RETRANSMIT SAMS TRANSACTIONS
 ;
 ;NOTE: DON'T CREATE ENTRY IN ASUW TRANSMISSION STATISTICS FILE
 ;      UNLESS AN ENTRY IS FOUND WHICH HAS BEEN TRANSMITTED FOR A WHILE
 ;      BUT NO CONFIRMATION HAS BEEN RECEIVED
 ;
 N ASUTRANS,ASUXMZ
 D ^XBKVAR
 Q:'$D(ASUW(9002036.88,"ATRANS",2))
 Q
MSG(X,Y) ;----- CREATE MAIL MESSAGE STUB
 ;
 N XMSUB,XMDUZ,XMZ
 S XMSUB=$$SITE_"\"_DT_"\"_Y_"\"_"SAMS DATA TRANSMISSION"
 S XMDUZ="SAMS PACKAGE"
 D XMZ^XMA2
 S X=XMZ
 Q
GET(XMZ) ;----- GET DATA AND STUFF INTO MAIL MESSAGE
 ;
 ;NOTE: SHOULD I LIMIT MESSAGE TO A PARTICULAR NUMBER OF RECORDS?
 ;
 ;      ASUL = mail message line counter
 ;      ASUWN = node
 ;      ASUR = record count
 ;      ASUX = record number
 ;
 N ASUDATA,ASUL,ASUWN,ASUR,ASUX
 K ^TMP("ASU",$J,"X")
 S ASUL=1,ASUR=0
 S ^XMB(3.9,XMZ,2,ASUL,0)="$$START"
 S ASUX=0 F  S ASUX=$O(^ASUW(9002036.88,"ATRANS",1,ASUX)) Q:'ASUX  D
 . S ASUR=ASUR+1
 . F ASUWN=0,1,3,4,5 D
 . . S ASUL=ASUL+1
 . . S ASUDATA=$G(^ASUW(9002036.88,ASUX,ASUWN))
 . . I $P(ASUDATA,U,6) S $P(ASUDATA,U,6)=$P($G(^VA(200,$P(ASUDATA,U,6),0)),U)
 . . I $P(ASUDATA,U,18) S $P(ASUDATA,U,18)=$P($G(^AUTTVNDR($P(ASUDATA,U,18),0)),U)
 . . S ^XMB(3.9,XMZ,2,ASUL,0)=ASUR_ASUWN_U_ASUDATA
 . S ^TMP("ASU",$J,"X",ASUX,0)=XMZ_U_DT
 S ASUL=ASUL+1
 S ^XMB(3.9,XMZ,2,ASUL,0)="$$END"
 S ^XMB(3.9,XMZ,2,0)="^3.92^"_ASUL_U_ASUL_U_DT
 Q
SEND(XMZ)          ;
 ;----- SEND MAIL MESSAGE
 ;
 N XMDUN,XMY
 S XMDUN="SAMS PACKAGE"
 S XMY("DOE,MARY@TST.DSD-ALB1.DOMAIN.NAME")=""
 D ENT1^XMD
 Q
MARK(ASUTRANS)     ;
 ;----- MARK FILE ENTRIES TRANSMITTED
 ;
 N ASUDT,ASUMSG,ASUX,DA,DD,DIC,DIE,DLAYGO,DO,DR,X,Y
 S ASUX=0 F  S ASUX=$O(^TMP("ASU",$J,"X",ASUX)) Q:'ASUX  D
 . S ASUMSG=^TMP("ASU",$J,"X",ASUX,0)
 . S ASUDT=$P(ASUMSG,U,2)
 . S DIE="^ASUW(9002036.88,"
 . S DA=ASUX
 . S DR="9991///2;9992///^S X=ASUTRANS"
 . D ^DIE
 . K DA,DD,DIE,DO,DR,X,Y
 . S DA(1)=ASUTRANS
 . S DIC="^ASUW(9002036.77,"_DA(1)_",99,"
 . S DIC(0)="L"
 . S DIC("P")=$P(^DD(9002036.77,99,0),U,2)
 . S DLAYGO=9002036.77
 . S X=ASUX
 . D FILE^DICN
 K DA,DIE,DR,X,Y
 S DIE="^ASUW(9002036.77,"
 S DA=ASUTRANS
 S DR=".02///^S X=ASUDT;.03///^S X=+ASUMSG"
 D ^DIE
 Q
SITE() ;----- GET SITE'S DOMAIN NAME
 ;
 N X
 S X=$P(^DIC(4.2,$P(^XMB(1,1,0),U),0),U)
 Q X
TRANS(X) ;----- GET TRANSMISSION NUMBER
 ;
 N D0,DA,DD,DI,DIC,DIE,DO,DQ,DR,Y
 L +^ASUW(9002036.77,0):DTIME
 S X=$P(^ASUW(9002036.77,0),U,3)
 F X=X:1 Q:'$D(^ASUW(9002036.77,X))
 K DD,DO
 S DIC="^ASUW(9002036.77,",DIC(0)="",DA=X
 S DIC("DR")=".02///^S X=DT"
 D FILE^DICN
 S X=+Y
 L -^ASUW(9002036.77,0)
 Q
QUIT ;----- CLEAN UP AND QUIT
 ;
 K ^TMP("ASU",$J,"X")
 Q