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

XPDCOM.m

Go to the documentation of this file.
  1. XPDCOM ;SFISC/RSD - Compare Transport Global ;08/14/2008
  1. ;;8.0;KERNEL;**21,58,108,124,393,506,539,547**;Jul 10, 1995;Build 16
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. EN1 ;compare to current system
  1. N DIC,DIR,DIRUT,DITCPT,DTOUT,DUOUT,POP,XPD,XPDA,XPDC,XPDNM,XPDT,XPDST,XPDUL,Y,Z,%ZIS
  1. S XPDST=$$LOOK^XPDI1("I '$P(^(0),U,9),$D(^XTMP(""XPDI"",Y))",1) Q:XPDST'>0
  1. S DIR(0)="SO^1:Full Comparison;2:Second line of Routines only;3:Routines only;4:Old style Routine compare",DIR("A")="Type of Compare",DIR("?")="Enter the type of comparison." ;rwf
  1. D ^DIR Q:Y=""!$D(DTOUT)!$D(DUOUT)
  1. S XPDC=Y,Y="JOB^XPDCOM",Z="Transport Global Compare",XPD("XPDNM")="",XPD("XPDC")="",XPD("XPDT(")=""
  1. D EN^XUTMDEVQ(Y,Z,.XPD)
  1. Q
  1. ;
  1. JOB ;Loop thru XPDT
  1. N XPDIT
  1. F XPDIT=0:0 S XPDIT=$O(XPDT(XPDIT)) Q:XPDIT'>0 D COM(+XPDT(XPDIT))
  1. Q
  1. ;
  1. COM(XPDA) ;XPDA=ien of package in ^XTMP("XPDI"
  1. Q:'$D(^XTMP("XPDI",$G(XPDA)))
  1. S:$D(XPDT("DA",XPDA)) XPDNM=$P(XPDT(+XPDT("DA",XPDA)),U,2)
  1. D HDR,COMR,EN^XPDCOMG:XPDC=1
  1. W !!
  1. Q
  1. ;
  1. COMR ;compare routines
  1. N DL,NAME,RM,XL,XPDI,X,XL,Y,YL,XPDHEAD
  1. S (NAME,XPDI)="",RM=IOM/2-8
  1. F S XPDI=$O(^XTMP("XPDI",XPDA,"RTN",XPDI)) Q:XPDI="" S X=+$G(^(XPDI)) D
  1. .S NAME=" Routine: "_XPDI,XPDHEAD=0
  1. .I X W:X=1 !!,"*DELETE*",NAME,! Q
  1. .S X=XPDI X ^%ZOSF("TEST") E W !!,"*ADD*",NAME,! Q
  1. .;check 2nd line only
  1. .I XPDC=2 D Q
  1. ..S XL(2)=$G(^XTMP("XPDI",XPDA,"RTN",XPDI,2,0)),YL(2)=$T(+2^@XPDI)
  1. ..D EN^XPDCOML("XL","YL",NAME)
  1. ..W:'XPDHEAD !,?IOM-$L(NAME)\2,NAME
  1. ..W !
  1. ..;lines the same or site routine has no patches
  1. ..I XL(2)=YL(2)!(YL(2)'["**") Q
  1. ..;check patch string
  1. ..S X=$P(XL(2),"**",2),XL=$L(X,","),Y=$P(YL(2),"**",2),YL=$L(Y,",")
  1. ..Q:X=Y
  1. ..;incoming has more patches than system, remove last patch and check if the same
  1. ..I XL>YL W:$P(X,",",1,(XL-1))'=Y "*** WARNING, you are missing one or more Patches ***",! Q
  1. ..;incoming has less patches
  1. ..I YL>XL W "*** WARNING, your routine has more patches than the incoming routine ***",! Q
  1. ..;incoming has same number of patches, check if they are the same
  1. ..I XL=YL,X'=Y W "*** WARNING, your routine has different patches than the incoming routine ***",! Q
  1. ..Q
  1. .;get number of lines in rouitine, XL
  1. .F X=1:1 Q:'$D(^XTMP("XPDI",XPDA,"RTN",XPDI,X))
  1. .S XL=X-1
  1. .K ^TMP($J,XPDI)
  1. .F X=1:1 S Y=$T(+X^@XPDI) Q:Y="" S ^TMP($J,XPDI,X,0)=Y
  1. .S DL=X-1 ;number of line in routine on disk
  1. .D EN^XPDCOML($NA(^XTMP("XPDI",XPDA,"RTN",XPDI)),$NA(^TMP($J,XPDI)),NAME):XPDC<4,COMP:XPDC=4
  1. .W:'XPDHEAD !,?IOM-$L(NAME)\2,NAME
  1. .W ! K ^TMP($J,XPDI)
  1. .Q
  1. I NAME="" W ?RM,"No Routines"
  1. Q
  1. ;
  1. COMP ;taken from XMPC routine
  1. N D1,DI,I,J,K,NL,X1,XI,Y1
  1. S (XI,DI)=0,NL=5,XPDHEAD=1
  1. W !,?IOM-$L(NAME)\2,NAME
  1. ;check each line in the incoming routine,X1, against the routine on disk,D1
  1. F S XI=XI+1,DI=DI+1 Q:XI>XL!(DI>DL) D:^XTMP("XPDI",XPDA,"RTN",XPDI,XI,0)'=^TMP($J,XPDI,DI,0)
  1. .S X1=^XTMP("XPDI",XPDA,"RTN",XPDI,XI,0),Y1=0
  1. .;if lines are not the same, look ahead five lines in D1
  1. .F I=DI:1:$S(DI+NL<DL:DI+NL,1:DL) S D1=^TMP($J,XPDI,I,0) D Q:Y1
  1. ..F K=1:5:26 Q:$L($E(D1,K,K+10))<7 I $F(X1,$E(D1,K,K+10)) D Q
  1. ...;print the lines upto the line that are the same
  1. ...F J=DI:1:I-1 D WP(^TMP($J,XPDI,J,0),2)
  1. ...;quit if the lines are equal
  1. ...S DI=I,Y1=1 Q:D1=X1
  1. ...;if lines are equal, print old and new
  1. ...D WP(D1,3),WP(X1,4)
  1. .Q:Y1 D WP(X1,1) S DI=DI-1
  1. ;check remaining lines in routines
  1. I XI>XL&(DI<(DL+1)) F I=DI:1:DL D WP(^TMP($J,XPDI,I,0),2)
  1. I DI>DL&(XI<(XL+1)) F I=XI:1:XL D WP(^XTMP("XPDI",XPDA,"RTN",XPDI,I,0),1)
  1. Q
  1. WP(X,Y) ;
  1. W !,"* "_$P("ADD^DEL^OLD^NEW",U,Y)_" * ",X
  1. Q
  1. ;
  1. HDR ;
  1. S $P(XPDUL,"-",80)=""
  1. W @IOF,!,"Compare KIDS package ",XPDNM," to current site (Disk)"
  1. W !,"Site: ",$$KSP^XUPARAM("WHERE")
  1. D GETENV^%ZOSV W " UCI: ",$P(Y,U),",",$P(Y,U,2)," ",?IOM/2+2,$$FMTE^XLFDT($$NOW^XLFDT()),!
  1. I XPDC>1 W:XPDC=2 "2nd Line of " W "Routines Only",!
  1. W ?3,"KIDS",?IOM\2+3,"Disk",!
  1. W XPDUL,!
  1. Q