PARM !fset="",!fcode="",!edoptionx="F",!edfrom="",!edto="",!edcase="Y" echo EDITAUTO (V.1.0) Compliments of Beechglen Development, Inc. echo echo The user accepts full responsibility for use of this software. echo This code is released as freeware. In no circumstances shall echo Beechglen Development be held responsible for its use. echo echo Features: Use EDITOR.PUB.SYS to find/list up to 2 strings echo in a fileset or replace one string with another or echo execute a USE file ("EDITAUIN") against a fileset. echo NOTE: EDITOR only accepts UNNUMBERED 'USE' files. echo comment comment Examples of how to use EDITAUTO comment comment To FIND 1 string matching its case exactly: comment EDITAUTO fileset,,F,this,,Y comment comment To FIND 2 strings ignoring case: comment EDITAUTO fileset,,F,this,that,N comment comment To CHANGE 1 string of exact case to another string: comment EDITAUTO fileset,,C,ThIs,THaT,Y comment comment To CHANGE 1 string to another ignoring case: comment EDITAUTO fileset,,C,ThInK,think,n comment comment To process files having the filecode "EDTCT": comment EDITAUTO fileset,EDTCT,F,THIS,,Y comment comment To utilize the USE file command in 'EDITAUIN': comment EDITAUTO fileset,,U comment comment EDITAUTO (this command file) program notes: comment comment utilizes this file equation: FILE EDITIN=EDCOMMS,OLDTEMP comment utilizes various variables beinging with "_" comment utilizes temporary files: EDLIST,EDFILE,EDCOMMS,EDTRAIL comment edoptionx = "U" utilizes a permanent file name EDITAUIN comment cleans up at end. all but temp file EDTRAIL is deleted. comment comment HISTORY comment ------- comment John Backus 07/01/1998 Created. MPE/iX 5.5. comment echo EDITAUTO is: echo Subject to limitations of EDITOR.PUB.SYS. echo Lockworded files and files w/EOF=0 are bypassed. echo Any file named EDITAUTO is bypassed. echo Temp audit file 'EDTRAIL', purged/created each run. echo comment Now doing simple edit checks on user parms specified... SETVAR _edoptionx ups("!edoptionx") SETVAR _edmatchcase ups("!edcase") IF "!_edoptionx" <> "U" AND "!_edoptionx" <> "F" & AND "!_edoptionx" <> "C" echo echo FROM EDITAUTO: only 'U','F','C' values allowed for parm # 3 echo ENDIF IF "!_edoptionx" = "C" and "!edfrom" = "" echo echo FROM EDITAUTO: C(hange) requires a non null parm 4 value echo ENDIF IF "!_edmatchcase" <> "Y" AND "!_edmatchcase" <> "N" echo echo FROM EDITAUTO: only 'Y' or 'N' values allowed for parm # 6 echo ENDIF IF ups("!_edoptionx") = "U" setvar _editauin_exists finfo("EDITAUIN",0) IF _editauin_exists = TRUE SETVAR _editauineof FINFO("EDITAUIN",19) IF _editauineof = 0 echo echo Use file processing was specified but the echo permanent Use file named EDITAUIN is empty. echo ENDIF ELSE echo echo Use file processing was specified but the echo permanent Use file named EDITAUIN, does not exist. echo ENDIF ENDIF SETVAR HPMSGFENCE,1 echo echo ************************************************************** echo You are cautioned that securing a BACKUP copy of the fileset echo being modified BEFORE MODIFICATION is strongly recommended. echo ************************************************************** echo echo Please verify that you agree with the following specifications: echo echo Parm1, Fileset to process = !fset echo Parm2, Only process files with filecode = !fcode echo Parm3, U(se file), C(hange), F(ind) = !edoptionx IF ups("!edoptionx") = "C" echo Parm4, From string = !edfrom echo Parm5, To string = !edto ELSEIF ups("!edoptionx") = "F" echo Parm4, Search string1 = !edfrom IF "!edto" <> "" echo Parm5, Search string2 = !edto ELSE echo Parm5, Search string2 = !edto, none given so not used. ENDIF ELSEIF ups("!edoptionx") = "U" echo echo USE file processing was specified. Did you keep EDITAUTO's echo 'USE' file named EDITAUIN as an UNNUMBERED file? Remember echo that modifying a fileset requires that a KEEP command echo be supplied. Remember to use an EXIT command and also be aware echo that EDITOR stops processing a USE file after the first error. echo ?? YOU HAVE ALREADY TESTED THIS ON A TEST INPUT FILE ?? echo Here is the contents of the 'USE' file "EDITAUIN": echo PRINT EDITAUIN;PAGE=0 echo ENDIF IF ups("!edoptionx") <> "U" echo Parm6, Match case of Parm4/5 strings? = !_edmatchcase echo ENDIF setvar _eduserreply,"X" input _eduserreply;prompt= & "Are the specs above correct? (Y/N) [default=N]->";wait=30 IF _eduserreply <> "Y" AND _eduserreply <> "y" THEN echo echo You DISAGREE with the specification. EDITAUTO has stopped. echo deletevar _eduserreply SETVAR HPMSGFENCE,0 RETURN ELSE echo echo You AGREE with the specifications. EDITAUTO now proceeding. echo ENDIF continue PURGE EDTRAIL,TEMP continue PURGE EDLIST LISTFILE !fset,6 > EDLIST SAVE EDLIST SETVAR _edlisteof FINFO("EDLIST",19) SETVAR _edlistrectoproc 1 FILE EDITIN=EDCOMMS,OLDTEMP SETVAR _ednbrfilesprocessed,0 SETVAR _ednbrfilesbypassed,0 WHILE !_edlistrectoproc < !_edlisteof & OR !_edlistrectoproc = !_edlisteof PRINT EDLIST;START=!_edlistrectoproc;END=!_edlistrectoproc > EDFILE INPUT _edfile_line < EDFILE SETVAR _edfile str('!_edfile_line',1,26) SETVAR _edfileeof FINFO("!_edfile",19) SETVAR _edfcode FINFO("!_edfile",9) SETVAR _edfile1st8chars str('!_edfile',1,8) SETVAR _edlockword FINFO("!_edfile",33) IF !_edfileeof <> 0 AND "!_edfcode" = "!fcode" & AND "!_edlockword" = "" AND "!_edfile1st8chars" <> "EDITAUTO" & AND "!_edfile1st8chars" <> "EDITAUIN" echo echo * From EDITAUTO: Now processing the file: !_edfile echo !_edfile was processed. >> EDTRAIL SETVAR _edfrom_low dwns("!edfrom") SETVAR _edfrom_up ups("!edfrom") SETVAR _edto_low dwns("!edto") SETVAR _edto_up ups("!edto") echo TEXT !_edfile > EDCOMMS IF "!_edoptionx" = "U" echo USE EDITAUIN >> EDCOMMS ELSEIF "!_edmatchcase" = "Y" OR "!_edmatchcase" = "y" IF "!_edoptionx" = "C" echo C "!edfrom" TO "!edto" IN ALL >> EDCOMMS echo KEEP >> EDCOMMS echo Y >> EDCOMMS echo EXIT >> EDCOMMS ELSEIF "!_edoptionx" = "F" echo FIND "!edfrom" IN ALL >> EDCOMMS IF "!edto" <> "" echo FIND "!edto" IN ALL >> EDCOMMS ENDIF echo EXIT >> EDCOMMS ENDIF ELSEIF "!_edoptionx" = "C" echo C "!_edfrom_up" TO "!edto" IN ALL >> EDCOMMS echo C "!_edfrom_low" TO "!edto" IN ALL >> EDCOMMS echo KEEP >> EDCOMMS echo Y >> EDCOMMS echo EXIT >> EDCOMMS ELSEIF "!_edoptionx" = "F" echo F "!_edfrom_up" IN ALL >> EDCOMMS echo F "!_edfrom_low" IN ALL >> EDCOMMS IF "!edto" <> "" echo F "!_edto_up" IN ALL >> EDCOMMS echo F "!_edto_low" IN ALL >> EDCOMMS ENDIF echo EXIT >> EDCOMMS ENDIF RUN EDITOR.PUB.SYS SETVAR _ednbrfilesprocessed _ednbrfilesprocessed + 1 ELSE echo echo * From EDITAUTO: bypassing the file: !_edfile (!_edfcode) echo !_edfile (!_edfcode/!_edlockword) was bypassed. >> EDTRAIL SETVAR _ednbrfilesbypassed _ednbrfilesbypassed + 1 ENDIF SETVAR _edlistrectoproc _edlistrectoproc + 1 ENDWHILE echo echo By way of reminder you had specified the following to EDITAUTO: echo echo echo Parm1, Fileset to process = !fset echo Parm2, Only process files with filecode = !fcode echo Parm3, U(se file), C(hange), F(ind) = !edoptionx IF ups("!edoptionx") = "C" echo Parm4, From string = !edfrom echo Parm5, To string = !edto ELSEIF ups("!edoptionx") = "F" echo Parm4, Search string1 = !edfrom IF "!edto" <> "" echo Parm5, Search string2 = !edto ELSE echo Parm5, Search string2 = !edto, none given so not used. ENDIF ELSEIF ups("!edoptionx") = "U" echo echo USE file processing ("EDITAUIN") specified. echo Here is the contents of the 'USE' file "EDITAUIN": echo PRINT EDITAUIN;PAGE=0 ENDIF IF ups("!edoptionx") <> "U" echo Parm6, Match case of Parm4/5 strings? = !_edmatchcase echo ENDIF echo * From EDITAUTO: Activity recap follows: echo echo Number of files in the fileset = !_edlisteof echo Number of files processed = !_ednbrfilesprocessed echo Number of files bypassed = !_ednbrfilesbypassed echo PRINT EDTRAIL;PAGE=0 echo comment now cleanup variables and workfiles continue deletevar _edlisteof continue deletevar _edlistrectoproc continue deletevar _edfile continue deletevar _edfileeof continue deletevar _edfcode continue deletevar _edfile1st8chars continue deletevar _edfile_line continue deletevar _edfrom_low continue deletevar _edfrom_up continue deletevar _edto_low continue deletevar _edto_up continue deletevar _eduserreply continue deletevar _edoptionx continue deletevar _edmatchcase continue deletevar _edlockword continue deletevar _ednbrfilesprocessed continue deletevar _ednbrfilesbypassed continue deletevar _editauin_exists continue deletevar _editauin_eof continue PURGE EDCOMMS,TEMP continue PURGE EDLIST continue PURGE EDFILE RESET EDITIN SETVAR HPMSGFENCE,0 echo * From EDITAUTO: has finished.