| [613] | 1 | VAQFILE2 ;ALB/MFK - MESSAGE FILING;19-OCT-95 | 
|---|
|  | 2 | ;;1.5;PATIENT DATA EXCHANGE;**16,20**;NOV 17, 1993 | 
|---|
|  | 3 | FILESEG(FILE,DA,FIELD,VALUE1,VALUE2,VALUE3) ;FILE INFORMATION | 
|---|
|  | 4 | ;INPUT  : FILE - File number | 
|---|
|  | 5 | ;         DA - IFN of entry to edit | 
|---|
|  | 6 | ;         FIELD - Field of multiple | 
|---|
|  | 7 | ;         VALUE1 - Name of segment to be filed | 
|---|
|  | 8 | ;         VALUE2 - Time limit of segment being filed | 
|---|
|  | 9 | ;         VALUE3 - Occurrence limit of segment being filed | 
|---|
|  | 10 | ;OUTPUT : 0 - Success | 
|---|
|  | 11 | ;        -1^Error_text - Error | 
|---|
|  | 12 | ;NOTES  : It is the responsibility of | 
|---|
|  | 13 | ;         the calling routine to verify that VALUE can be added as | 
|---|
|  | 14 | ;         an entry in the multiple.  It is also the responsibility | 
|---|
|  | 15 | ;         of the calling routine to verify that VALUE is an entry in | 
|---|
|  | 16 | ;         the subfile when deleting/editing. | 
|---|
|  | 17 | ; | 
|---|
|  | 18 | ;CHECK INPUT | 
|---|
|  | 19 | Q:('$G(FILE)) "-1^Did not pass file number" | 
|---|
|  | 20 | Q:('$D(^DD(FILE))) "-1^Did not pass valid file number" | 
|---|
|  | 21 | Q:('$G(DA)) "-1^Did not pass entry number" | 
|---|
|  | 22 | Q:('$D(FIELD)) "-1^Field not passed" | 
|---|
|  | 23 | S VALUE1=$G(VALUE1) | 
|---|
|  | 24 | Q:(VALUE1="") "-1^No .01 sent" | 
|---|
|  | 25 | S VALUE2=$G(VALUE2) | 
|---|
|  | 26 | S VALUE3=$G(VALUE3) | 
|---|
|  | 27 | ;DECLARE VARIABLES | 
|---|
|  | 28 | N DIE,DR,X,DIC,Y,DLAYGO | 
|---|
|  | 29 | K DD,DO | 
|---|
|  | 30 | ; SET UP FILE^DICN CALL | 
|---|
|  | 31 | S DIC=$G(^DIC(FILE,0,"GL")) | 
|---|
|  | 32 | S DIC(0)="XL" | 
|---|
|  | 33 | S DLAYGO=FILE | 
|---|
|  | 34 | Q:(DIC="") "-1^Could not determine global root of file" | 
|---|
|  | 35 | Q:('$D(@(DIC_DA_")"))) "-1^Did not pass valid entry number" | 
|---|
|  | 36 | S MULT=$P($P($G(^DD(FILE,FIELD,0)),"^",4),";",1) | 
|---|
|  | 37 | S DIC=DIC_DA_",MULT," | 
|---|
|  | 38 | S DIC("P")=+$P($G(^DD(FILE,FIELD,0)),"^",2) | 
|---|
|  | 39 | I ('DIC("P")) Q "-1^Main field is not a multiple" | 
|---|
|  | 40 | S DA(1)=DA | 
|---|
|  | 41 | S DIC("DR")=".01////"_VALUE1_";.02////"_VALUE2_";.03////"_VALUE3 | 
|---|
|  | 42 | S X=VALUE1 | 
|---|
|  | 43 | D FILE^DICN | 
|---|
|  | 44 | Q:($D(Y)="-1") "-1^Could not file new value" | 
|---|
|  | 45 | Q 0 | 
|---|