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

VAQFILE1.m

Go to the documentation of this file.
  1. VAQFILE1 ;ALB/JRP/KLD - MESSAGE FILING;12-MAY-93 [ 09/16/96 9:44 AM ]
  1. ;;1.5;PATIENT DATA EXCHANGE;**22,34**;NOV 17, 1993
  1. NEWDATA() ;MAKE NEW ENTRY IN DATA FILE
  1. ;INPUT : NONE
  1. ;OUTPUT : IFN - Success
  1. ; -1^Error_text - Error
  1. ;
  1. ;DECLARE VARIABLES
  1. N DD,DIC,X,DINUM,Y,DLAYGO
  1. S DIC="^VAT(394.62,",DLAYGO=394.62
  1. S DIC(0)="L"
  1. S X="+" ;-- auto numbering - see ^DD(394.62,.01,7.5). It involves $$AUTO^VAQXRF2(2) and file 394.86.
  1. D ^DIC
  1. I Y<0 Q "-1^Could not create entry in data file"
  1. Q $P(Y,"^",1)
  1. ;
  1. DELDATA(DA) ;DELETE ENTRY IN DATA FILE
  1. ;INPUT : DA - Pointer to VAQ - DATA file
  1. ;OUTPUT : 0 - Success
  1. ; -1^Error_text - Error
  1. ;
  1. ;CHECK INPUT
  1. Q:('(+$G(DA))) "-1^Did not pass pointer to data"
  1. ;IF DATA DOES NOT EXIST RETURN SUCCESS
  1. ;Q:('$D(^VAT(394.62,DA))) 0
  1. Q:('$D(^VAT(394.62,DA))) "-1^No Data Exist Record not Deleted"
  1. ;DECLARE VARIABLES
  1. N DIK
  1. ;DELETE ENTRY
  1. S DIK="^VAT(394.62,"
  1. D ^DIK
  1. Q:('$D(^VAT(394.62,DA))) 0
  1. Q "-1^Unable to delete data"
  1. ;
  1. DELSEG(SEG,TRAN) ;DELETE SEGMENT IN DATA FILE FOR A TRANSACTION
  1. ;INPUT : SEG - Segment abbreviation
  1. ; TRAN - Pointer to VAQ - TRANSACTION file
  1. ;OUTPUT : 0 - Success
  1. ; -1^Error_Text - Error
  1. ;
  1. ;CHECK INPUT
  1. Q:($G(SEG)="") "-1^Did not pass segment abbreviation"
  1. S TRAN=+$G(TRAN)
  1. Q:(('TRAN)!('$D(^VAT(394.61,TRAN)))) "-1^Did not pass valid transaction"
  1. ;DECLARE VARIABLES
  1. N DATAPTR,TMP,SEGPTR
  1. ;GET SEGMENT POINTER
  1. S SEGPTR=+$O(^VAT(394.71,"C",SEG,""))
  1. Q:('SEGPTR) "-1^Did not pass valid segment abbreviation"
  1. ;DELETE ENTRIES IN DATA FILE
  1. S DATAPTR=""
  1. F S DATAPTR=+$O(^VAT(394.62,"A-SEGMENT",TRAN,SEGPTR,"")) Q:('DATAPTR) S TMP=$$DELDATA(DATAPTR)
  1. Q 0
  1. ;
  1. STUBDATA(SEG,TRAN) ;CREATE STUB ENTRY IN DATA FILE
  1. ;INPUT : SEG - Segment abbreviation
  1. ; TRAN - Pointer to VAQ - TRANSACTION file
  1. ;OUTPUT : IFN - Success
  1. ; -1^Error_text - Error
  1. ;NOTES : The following fields (in addition to .01) will be filled in
  1. ; .02 - Segment
  1. ; .05 - Display Ready
  1. ; 40 - Transaction Number
  1. ;
  1. ;CHECK INPUT
  1. Q:($G(SEG)="") "-1^Did not pass segment abbreviation"
  1. S TRAN=+$G(TRAN)
  1. Q:(('TRAN)!('$D(^VAT(394.61,TRAN)))) "-1^Did not pass valid transaction"
  1. ;DECLARE VARIABLES
  1. N IFN,SEGNAME,TMP,TRANNUM,DIE,DR,Y,DA,DISPLAY
  1. ;GET SEGMENT NAME
  1. S TMP=+$O(^VAT(394.71,"C",SEG,""))
  1. Q:('TMP) "-1^Did not pass valid segment abbreviation"
  1. S TMP=$G(^VAT(394.71,TMP,0))
  1. S SEGNAME=$P(TMP,"^",1)
  1. Q:(SEGNAME="") "-1^Could not determine segment name"
  1. ;DETERMINE IF SEGMENT IS DISPLAY READY
  1. S DISPLAY=+$P(TMP,"^",3)
  1. S DISPLAY=$S(DISPLAY:"YES",1:"NO")
  1. ;GET TRANSACTION NUMBER
  1. S TRANNUM=+$G(^VAT(394.61,TRAN,0))
  1. Q:('TRANNUM) "-1^Could not determine transaction number"
  1. ;MAKE ENTRY IN DATA FILE
  1. S IFN=+$$NEWDATA
  1. Q:(IFN<0) "-1^Could not create entry in data file"
  1. ;PLACE INFO IN NEW ENTRY
  1. L +^VAT(394.62,IFN):60 I ('$T) S TMP=$$DELDATA(IFN) Q "-1^Could not edit entry (locked by other user)"
  1. ;PLACE SEGMENT NAME INTO DATA
  1. S DIE="^VAT(394.62,"
  1. S DA=IFN
  1. S DR=".02///"_SEGNAME
  1. D ^DIE
  1. I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file segment name"
  1. ;PLACE DISPLAY READY FLAG INTO DATA
  1. S DIE="^VAT(394.62,"
  1. S DA=IFN
  1. S DR=".05///"_DISPLAY
  1. D ^DIE
  1. I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file display ready flag"
  1. ;PLACE TRANSACTION NUBMER INTO DATA
  1. S DIE="^VAT(394.62,"
  1. S DA=IFN
  1. S DR="40///"_TRANNUM
  1. D ^DIE
  1. I ($D(Y)#2) L -^VAT(394.62,IFN) S TMP=$$DELDATA(IFN) Q "-1^Could not file transaction number"
  1. L -^VAT(394.62,IFN)
  1. Q IFN