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

DDSPTR.m

Go to the documentation of this file.
  1. DDSPTR ;SFISC/MKO-SET "PT" AND "PTB" NODES ;9:43 AM 4 Apr 1996
  1. ;;22.0;VA FileMan;;Mar 30, 1999
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. PT(DDSDDP,EXP,DDS,PG,BK) ;Set "PT" and "PTB" nodes
  1. N DDP,FDL,CD,FD
  1. S DDP=DDSDDP
  1. S $P(@DDSREFS@(PG,BK),U,8)=1
  1. ;
  1. D:EXP?1"FO(".E FO(DDP,EXP,DDS,PG,BK,.CD,.FDL)
  1. D:EXP'?1"FO(".E DD(DDP,EXP,BK,.CD,.FDL)
  1. Q:$G(DIERR)
  1. ;
  1. S:FDL?.E1"^" FDL=$E(FDL,1,$L(FDL)-1)
  1. S @DDSREFS@(PG,BK,"PTB")=FDL
  1. F CD=1:1:CD S @DDSREFS@(PG,BK,"PTB",CD)=CD(CD)
  1. F CD=1:1:$L(FDL,U) D
  1. . S FD=$P($P(FDL,U,CD),";"),DDP=+FD,FD=$P(FD,",",2,99)
  1. . S @DDSREFS@("PT",DDP,FD,PG,BK)=""
  1. Q
  1. ;
  1. DD(DDP,EXP,BK,CD,FDL,COMP) ;Parse DD expression
  1. ;In:
  1. ; DDP = file #
  1. ; EXP = rel expr
  1. ; BK = blk # (to get DD# of blk)
  1. ; COMP = flag, EXP not pointer link
  1. ; 1, def is ext (DDSCOMP and DDSVAL)
  1. ; 2, def is int (DDSVAL)
  1. ;Returns:
  1. ; CD = array of code that sets DA
  1. ; FDL = list of flds used in expr
  1. ;
  1. N FD1,FD2,P,TYP
  1. I EXP?1"DD(".E D
  1. . N I
  1. . S I=$$RPAR^DDSLIB(EXP,3)
  1. . S DDP=$P($E(EXP,4,I-2),",")
  1. . S EXP=$P($E(EXP,4,I-2),",",2,999)_$E(EXP,I,999)
  1. ;
  1. I $G(DDP)="" D BLD^DIALOG(202,"file") Q
  1. ;
  1. LOOP S CD=$G(CD)+1
  1. LOOP1 I $E(EXP)="""" D
  1. . N I S I=$$AFTQ^DDSLIB(EXP)
  1. . S FD1=$$UQT^DDSLIB($E(EXP,1,I-1)),FD2=$P($E(EXP,I,999),":",2,999)
  1. . S P=$P($E(EXP,I,999),":")
  1. E D
  1. . S FD1=$P($P(EXP,":"),";"),FD2=$P(EXP,":",2,999)
  1. . S P=$P($P(EXP,":"),";",2,999)
  1. S FD1=$$FIELD^DDSLIB(DDP,FD1) Q:$G(DIERR)
  1. ;
  1. S TYP=$P(^DD(DDP,FD1,0),U,2)
  1. I TYP S DDP=+TYP,EXP=FD2 D:EXP="" BLD^DIALOG(3083) Q:EXP="" G LOOP1
  1. ;
  1. I FD2="",$G(COMP) D Q
  1. . S P=$S(COMP=1:P'["I",1:P["E")
  1. . S CD(CD)="S X=$$GET^DDSVAL("_DDP_","_$S(CD=1:".DA",1:"X")_","_FD1_$S(P:","""",""E""",1:"")_")"
  1. . S FDL=$G(FDL)_DDP_","_FD1_U
  1. ;
  1. I TYP["V" D Q:$G(DIERR)
  1. . S CD(CD)="S X=+$$GET^DDSVAL("_DDP_","_$S(CD=1:".DA",1:"X")_","_FD1_")"
  1. . S FDL=$G(FDL)_DDP_","_FD1_U
  1. . D GETFF(.FD2,.DDP)
  1. E I TYP["P" D
  1. . S CD(CD)="S X=$$GET^DDSVAL("_DDP_","_$S(CD=1:".DA",1:"X")_","_FD1_")"
  1. . S FDL=$G(FDL)_DDP_","_FD1_U
  1. . S DDP=+$P(TYP,"P",2)
  1. E D Q:$G(DIERR)
  1. . N D,F,S
  1. . S FDL=$G(FDL)_DDP_","_FD1_";J^"
  1. . D LKPARM(P,.F,.D,.S)
  1. . S CD(CD)="N D,DIC,Y S X=$$GET^DDSVAL("_DDP_","_$S(CD=1:".DA",1:"X")_","_FD1_$S(F:"",1:","""",""E""")_")"
  1. . D GETFF(.FD2,.DDP) Q:$G(DIERR)
  1. . I FD2="" D Q:$G(DIERR)
  1. .. I $G(COMP) D BLD^DIALOG(3083) Q
  1. .. S DDP=$P(^DIST(.404,BK,0),U,2)
  1. . I DDP="" D BLD^DIALOG(202,"file") Q
  1. . I '$D(^DD(DDP))!'$D(^DIC(DDP,0,"GL")) D Q
  1. .. N P S P("FILE")=DDP D BLD^DIALOG(401,.P)
  1. . S CD(CD)=CD(CD)_",DIC="""_^DIC(DDP,0,"GL")_""""_D_S_" S X=+Y"
  1. ;
  1. I FD2]"" S EXP=FD2 G LOOP
  1. S CD(CD)=CD(CD)_",DA=X"
  1. Q
  1. ;
  1. FO(DDP,EXP,DDS,PG,BK,CD,FDL,COMP) ;Parse FO expression
  1. N FD1,FD2,I,P
  1. ;
  1. S:'$D(DDS) DDS="" S:'$D(PG) PG="" S:'$D(BK) BK=""
  1. S CD=1
  1. S I=$$RPAR^DDSLIB(EXP,3)
  1. S FD1=$E(EXP,4,I-2),P=$P($E(EXP,I,999),":")
  1. S FD2=$P($E(EXP,I,999),":",2,999)
  1. F I=1:1:3 S P(I)=$$PIECE^DDSLIB(FD1,",",I)
  1. ;
  1. S FD1=$P($$GETFLD^DDSLIB(P(1),P(2),P(3),DDS,PG,BK,"F"),",",1,2)
  1. Q:$G(DIERR)
  1. ;
  1. I FD2="",$G(COMP) D Q
  1. . S P=$S(COMP=1:P'["I",1:P["E")
  1. . S CD(1)="S X=$$GET^DDSVALF("""_FD1_""","""","""","""_$S(P:"E",1:"")_""",DDSDA)"
  1. . S FDL=$G(FDL)_"0,"_FD1_U
  1. ;
  1. I $P($G(^DIST(.404,+$P(FD1,",",2),40,+FD1,20)),U)="" D Q
  1. . N P S P(1)="READ TYPE",P(2)="form-only field in the BLOCK"
  1. . D BLD^DIALOG(3011,.P)
  1. ;
  1. I $P(^DIST(.404,+$P(FD1,",",2),40,+FD1,20),U)["P" D
  1. . S CD(1)="S X=$$GET^DDSVALF("""_FD1_""","""","""","""",DDSDA)"
  1. . S FDL=$G(FDL)_"0,"_FD1_U
  1. . S DDP=U_$P($P(^DIST(.404,+$P(FD1,",",2),40,+FD1,20),U,3),":")
  1. E D Q:$G(DIERR)
  1. . N D,F,S
  1. . S FDL=$G(FDL)_"0,"_FD1_";J^"
  1. . D LKPARM(P,.F,.D,.S)
  1. . S CD(1)="N D,DIC,Y S X=$$GET^DDSVALF("""_FD1_""","""","""","""_$S(F:"",1:"E")_""",DDSDA)"
  1. . D GETFF(.FD2,.DDP) Q:$G(DIERR)
  1. . I FD2="" S DDP=$P(^DIST(.404,BK,0),U,2)
  1. . I DDP="" D BLD^DIALOG(202,"file") Q
  1. . I '$D(^DD(DDP))!'$D(^DIC(DDP,0,"GL")) D Q
  1. .. N P S P("FILE")=DDP D BLD^DIALOG(401,.P)
  1. . S CD(1)=CD(1)_",DIC="""_^DIC(DDP,0,"GL")_""""_D_S_" S X=+Y"
  1. ;
  1. I FD2="" S CD(CD)=CD(CD)_",DA=X"
  1. E S EXP=FD2 D DD(DDP,EXP,BK,.CD,.FDL,$G(COMP))
  1. Q
  1. ;
  1. GETFF(FD2,DDP) ;Get file, field
  1. ;Input: FD2=file:field:...
  1. ;Output: FD2=field:...
  1. ; DDP=file number
  1. I $E(FD2)="""" D
  1. . N I S I=$$AFTQ^DDSLIB(FD2,1)
  1. . S DDP=$$UQT^DDSLIB($E(FD2,1,I-1)),FD2=$E(FD2,I,999)
  1. E S DDP=$P(FD2,":"),FD2=$P(FD2,":",2,999)
  1. ;
  1. I DDP]"",DDP'=+$P(DDP,"E") D
  1. . I '$D(^DIC("B",DDP)) D BLD^DIALOG(3012,DDP) Q
  1. . S DDP=$O(^DIC("B",DDP,""))
  1. Q
  1. ;
  1. LKPARM(P,F,D,S) ;Parse lookup params
  1. ;In: P = specifiers separated by ;
  1. ;Out: F = 1 if int form wanted
  1. ; D = code that sets D and DIC(0)
  1. ; S = code that calls ^DIC
  1. N I,IP,L,M
  1. S (D,F,L,M)=""
  1. F I=1:1:$L(P,";") D
  1. . S IP=$P(P,";",I) Q:IP=""
  1. . I IP="I" S F=1 Q
  1. . I IP="L" S L=1 Q
  1. . I IP?.1"M"1"IX(".E1")" D Q
  1. .. S IP=$P($P(IP,"(",2),")")
  1. .. S:$E(IP)'="""" IP=$$QT^DDSLIB(IP)
  1. .. S D=",D="_IP
  1. .. I $L(IP,U)>1 S D=D_",DIC(0)=""MF""",S=" D MIX^DIC1"
  1. .. E S D=D_",DIC(0)=""F""",S=" D IX^DIC"
  1. S:D="" D=",DIC(0)=""MF""",S=" D ^DIC"
  1. S D=D_" S:$G(DDS1E) DIC(0)=DIC(0)_""E"_$E("L",L)_""""
  1. Q