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

AUPTFXT.m

Go to the documentation of this file.
  1. %AUPTFXT ;BRJ/IHS [ 03/09/87 7:32 AM ]
  1. W !,*7,"%AUPTFXT cannot be executed at this entry point!!"
  1. Q
  1. EN ;ENTRY FROM %AUPTFX - RUN %AUFXPT THEN ASK FOR FILEMAN AND USER FILE NAMES
  1. N AUPTPGM S AUPTPGM="<"_$T(+0)_">"
  1. F AUPTLBL="INFO","ASKARRAY","ASKFILE","ASKDSPLY","GO" D @(AUPTLBL):'AUPTQUIT
  1. K AUPTANS,AUPTI1,AUPTI2,AUPTPTFL,AUPTPTFD,AUPTDDFL
  1. Q
  1. INFO ;INFORM USER WHAT'S GOING TO HAPPEN AND CALL %AUFIXPT TO CLEAN UP "PT" NODE
  1. W !!,AUPTPGM,?11,"This program will exchange old (BAD!) pointer values for new (GOOD?)",!,?11,"pointer values in all FM files that point to a given file."
  1. W !!,?11,"The new pointer values should already be in a global array."
  1. Q
  1. ASKARRAY ;ASK FOR USER ARRAY GLOBAL NAME
  1. W !!,AUPTPGM,?11,"Please enter the name of this global.",!!,?15,*7,"Global name = ^"
  1. R AUPTANS:DTIME E D TIMEOUT Q
  1. I $E(AUPTANS)="?" D HLPARRAY G ASKARRAY
  1. I $E(AUPTANS=U&($L(AUPTANS)=1)) W !!,AUPTPGM,?11,"G o o d b y e !!" S AUPTQUIT=1 Q
  1. I AUPTANS="" D NOARRAY Q:AUPTQUIT G ASKARRAY
  1. I $E(AUPTANS)'=U S AUPTANS=U_AUPTANS
  1. S AUPTUFLE=AUPTANS
  1. I '$D(@AUPTUFLE) D NOARRAY Q:AUPTQUIT G ASKARRAY
  1. S AUPTUFLE=AUPTUFLE_"(AUPTOLDX)"
  1. Q
  1. NOARRAY ;USER ARRAY DOES NOT EXIST OR WASN'T ENTERED BY OPERATOR
  1. W !!,AUPTPGM,?11,"Your global name was not entered or does not exist!!",!,?15,"Do you want to continue?",!,?15,*7,"[Y]es or [N]o <N>// "
  1. R AUPTANS:DTIME E D TIMEOUT Q
  1. I $E(AUPTANS)'="Y" W !!,AUPTPGM,?11,"OK - I'm getting out now!!" S AUPTQUIT=1
  1. Q
  1. HLPARRAY ;HELP USER
  1. W !!,AUPTPGM,?11,"This program requires the user to have created a global that contains",!,?11,"the old/new pointer values.",!!,?11,"The format for the global is ^gbl(""old"")=new where:"
  1. W !,?15,"^gbl is the global name",!,?15,"""old"" is the old (BAD!) entry number",!,?21,"i.e. the value to be corrected",!,?15,"""new"" is the new (GOOD?) entry number",!,?21,"i.e. the correct value."
  1. Q
  1. ASKFILE ;ASK FILEMAN TO GET FILENAME
  1. W !!,AUPTPGM,?11,"I'm going to have FileMan ask you to enter the FM name or number of",!,?11,"the 'pointed to' file to be processed.",!,*7
  1. ASKFM S DIC="^DIC(",DIC(0)="MAEQ" D ^DIC S AUPTY=Y,AUPTFILE=+$P(Y,U,1) K DIC,DIC(0),Y
  1. I AUPTFILE<0 D NOFILE Q:AUPTQUIT G ASKFM
  1. S AUPTFSTK(1)=AUPTFILE
  1. Q
  1. NOFILE ;FILEMAN FILE WAS NOT ENTERED OR NOT FOUND
  1. W !!,AUPTPGM,?11,"No file was selected."
  1. W !!,AUPTPGM,?11,"Do you want to select another file?",!!,?15,*7,"[Y]es or [N]o <N>// "
  1. R AUPTANS:DTIME E D TIMEOUT Q
  1. I $E(AUPTANS)'="Y" W !!,AUPTPGM,?11,"OKIE DOKE - No action on this run. B Y E....." S AUPTQUIT=1
  1. Q
  1. ASKDSPLY ;ASK TO DISPLAY DATA NODES ARE THEY ARE EXCHANGED
  1. W !!,AUPTPGM,?11,"Do you want me to display the 'before and after' of each global node",!,?11,"when an exchange occurs?",!!,?11,"Answering <Y>es may extend the run time substantially!!",!!,?15,*7,"[Y]es or [N]o? <N>// "
  1. R AUPTANS:DTIME E D TIMEOUT Q
  1. S:$E(AUPTANS)="Y" AUPTDSPY=1
  1. Q
  1. GO ;OFF AND RUNNING
  1. W !!,AUPTPGM,?11,"O K - I'm set up to go.",!,?11,"Be prepared for this program to take some time."
  1. W !,AUPTPGM,?11,"I will display which FM file/field is being processed."
  1. W !!,?11,"Also, if you didn't want to display the 'before and after,",!,?11,"I will display the following characters accordingly:"
  1. W !,?15,"a ""-"" indicates a data node was found",!,?15,"a ""X"" indicates an exchange occurred.",!,?15,"a ""|"" indicates setting cross references, triggers, etc.",!,?19,"occurred."
  1. W !!,AUPTPGM,?11,"Press <RETURN> when ready!! W A I T I N G . . ."
  1. R AUPTANS:DTIME E D TIMEOUT Q
  1. W !!,AUPTPGM,?11,"I'm off and running......"
  1. Q
  1. TIMEOUT ;QUIT IF TIMEOUT ON READS OCCUR
  1. S AUPTEC=9,AUPTQUIT=1 D ERR
  1. Q
  1. ERR ;DISPLAY ERROR MESSAGES FROM ^AUPTFIX
  1. S AUPTSKIP=1
  1. W !!,*7,AUPTPGM,?11,$P($T(ERRMSG+(AUPTEC)),";;",2)
  1. Q:AUPTEC=9
  1. I AUPTEC=1 W !,?15,"FILE= ",$P(AUPTY,U,1)," - ",$P(AUPTY,U,2)
  1. E W !,?15,"FILE= ",AUPTPSFL," FIELD= ",AUPTPSFD,!!,AUPTPGM,?11,"Skipping to next ""PT"" node."
  1. Q
  1. ERRMSG ;;ERROR MESSAGE LIST
  1. 1 ;;File did not contain any "PT" nodes. No action.
  1. 2 ;;<SNAFU> Missing "0" node at ^DD(fl,fd,0)
  1. 3 ;;<SNAFU> Missing "NM" node at ^DD(fl,0,"NM",sflname)
  1. 4 ;;<SNAFU> Missing "B" node at ^DD(fl,"B",flname,upsflnbr)
  1. 5 ;;<SNAFU> Missing ^(1) or ^(2) node at ^DD(fl,fd,1,xridx,xrnbr)
  1. 6 ;;<SNAFU> Missing "GL" node at ^DIC(fl,0,"GL")
  1. 7 ;;<SNAFU> Missing "global name" at ^DD(fl,fd,0) for DINUM=X
  1. 8 ;;<SNAFU> Missing "0" node at ^DIC(fl,0)
  1. 9 ;;<TIME-OUT> Your took too long to respond. SO SORRY!! Bye bye!