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

PRC0B1.m

Go to the documentation of this file.
  1. PRC0B1 ;WISC/PLT-UTILITY ; 06/30/94 12:40 PM
  1. V ;;5.1;IFCAP;;Oct 20, 2000
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. QUIT ; invalid entry
  1. ;
  1. ;prca=~1 file number;file root;file record id;field # of multiple for adding
  1. ; ~2 subfile number;subfile root;subfile RI;field # of multiple for adding
  1. ; ~3 ...
  1. ;.x = .01 value or array of dic and X("DR") to input for other fields
  1. ;.y = value returned; -1 no new entry added, ^1=ri,^2=.01 value,^3=1 for new if added
  1. ADD(X,Y,PRCA,DINUM) ;add new entry
  1. N DD,DO,DIC,%,D0,DA,DI,DIE,DLAYGO,DQ,DR,A,B,C,I
  1. S:PRCA'?.E1"~" PRCA=PRCA_"~" S A=$L(PRCA,"~")-1
  1. I A>1 F B=1:1:A-1 S C=$P(PRCA,"~",B),DA(A-B)=$P(C,";",3) S:$P(C,";",4)]"" DIC("P")=$$DICP^PRC0B1(+C,$P(C,";",4))
  1. S B=$P(PRCA,"~",A),DIC=$P(B,";",2) S:DIC=""&(A=1) DIC=+B
  1. S DLAYGO=PRCA,DIC(0)="FIL"
  1. S:$D(X(0)) DIC(0)=X(0) S:$D(X("DR")) DIC("DR")=X("DR") K X(0),X("DR")
  1. D FILE^DICN
  1. QUIT
  1. ;
  1. ;prca = ~1 file number(option);file root;file record id
  1. ; ~2 subfile number(option);subfile root;subfile RI
  1. ; ~...
  1. ;.x = value return; 1 if deleted, 0 if not, -2 if lock fail
  1. DELETE(X,PRCA) ;delete entry
  1. N %,DA,DIC,Y
  1. N DIK,DIA,PRCLOCK,A,B,C
  1. S:PRCA'?.E1"~" PRCA=PRCA_"~" S A=$L(PRCA,"~")-1,PRCLOCK=""
  1. I A>1 F B=1:1:A-1 S C=$P(PRCA,"~",B),DA(A-B)=$P(C,";",3)
  1. S B=$P(PRCA,"~",A),DIK=$P(B,";",2),DA=$P(B,";",3),PRCLOCK=DIK_DA_","
  1. S X=3 D ICLOCK^PRC0B(PRCLOCK,.X) I 'X S X=-2 QUIT
  1. D ^DIK,DCLOCK^PRC0B(PRCLOCK)
  1. S X=1
  1. QUIT
  1. ;
  1. ;A=global root (including cross reference) ending with ','
  1. ;B=start value
  1. FIRST(A,B) ;$O-first node after B-value
  1. N C
  1. S @("C=$O("_A_"B))")
  1. QUIT C
  1. ;
  1. DICP(A,B) ;EF value=2nd piece of 0-node of the multiple field's dd entry
  1. QUIT $S(A&B:$P($G(^DD(A,B,0)),"^",2),1:"")
  1. ;
  1. ;
  1. DICGL(A) ;EF value=global root ending with ',' for file # A.
  1. QUIT $G(^DIC(A,0,"GL"))
  1. ;