Focal Point
[TECHNIQUE] Couple cool, large scale FEX management funzies

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9137045826

February 05, 2013, 01:26 PM
ABT
[TECHNIQUE] Couple cool, large scale FEX management funzies
I'm on a large project where (among other things) I have had to make 2 specific changes to build my program test bed.

main_loop.bat:
@ECHO OFF

REM *****************************************************************************
REM * WARNING: THIS SCRIPT WILL UNMERCIFULLY UPDATE WHATEVER FILES ARE LISTED IN
REM *          FILE_LIST.TXT.  BE VERY CAREFUL.
REM *****************************************************************************
REM * Read the comments carefully and if you still don't understand look up the 
REM * commands before running.
REM *****************************************************************************
REM * I can't / won't be responsible for negative effects of this script.
REM *****************************************************************************

REM Step 0: Loop through a list of given files.
for /f %%a in (file_list.txt) do (

	REM Step 1: Tell the user what file is being processed.
	echo Processing %%a

	REM Step 2: Prepend the file contents to the beginning of the file in the list.
	REM Save the results to a temporary filename.  This example uses a 1 at the end 
	REM of the file name
	type mrnoedit_include_epic2012_report.txt %%a > %%a1

	REM Step 3: Since file cannot be opened for both input and output at the same 
	REM time, rename the file above from a temp name back to the production name.
	move /y %%a1 %%a
)


file_list.txt:
\\server\C$\ibi\WebFOCUS768\basedir\ehrupgdh\app\Standards_ccdpats.fex
\\server\C$\ibi\WebFOCUS768\basedir\ehrupgdh\app\Standards_edh4pats.fex
\\server\C$\ibi\WebFOCUS768\basedir\ehrupgdh\app\Standards_edhospts.fex
...(snip)...


mrnoedit_include_epic2012_report.txt:
-MRNOEDIT -INCLUDE EPIC2012_REPORT



File Before:
-*=====================================================================*
-*    COPYRIGHT 2008, MY COMPANY, INC.                                 *
-*                      INFORMATION DELIVERY                           *
-*=====================================================================*
-* PROGRAM:      Readmits Reporting by Nurse Unit
...(snip)...


File After:
-MRNOEDIT -INCLUDE EPIC2012_REPORT
-*=====================================================================*
-*    COPYRIGHT 2008, MY COMPANY, INC.                                 *
-*                      INFORMATION DELIVERY                           *
-*=====================================================================*
-* PROGRAM:      Readmits Reporting by Nurse Unit
...(snip)...




- ABT

This message has been edited. Last edited by: Kerry,


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
February 05, 2013, 01:50 PM
ABT
Second task was to update a large list of MFDs (6000+) to point from one Data Adapter to another.

Update MFDs:
@ECHO OFF

REM *****************************************************************************
REM * WARNING: THIS SCRIPT WILL UNMERCIFULLY UPDATE FILES.  BE VERY CAREFUL.
REM *****************************************************************************
REM * Read the comments carefully and if you still don't understand look up the 
REM * commands before running.
REM *****************************************************************************
REM * I can't / won't be responsible for negative effects of this script.
REM *****************************************************************************

REM Step 0: read the output of the DIR command dynamically to produce a change list.
for /f %%a in ('dir /b c:\epic_2012\mfds\*.acx') do (

   REM Step 1: Tell the user what's hanppening
   echo Processing c:\epic_2012\mfds\%%a

   REM Step 2: Use SED to edit the file and change CLRTST_2012 to CLRPRD.  Add the CONNECTION flag
   REM to ensure it is only in the scope of the data adapter definition.  Hold the output to a 
   REM temporary directory with the same name.  Copy those files out to WebFOCUS server manually.
   sed "s/CONNECTION=CLRTST_2012/CONNECTION=CLRPRD/g" c:\epic_2012\mfds\%%a > c:\epic_2012\mfds\hstemp\%%a
)



MFD Before:
 SEGNAME=HSACC_CONFIG_BLK, TABLENAME=CLARITY.ACC_CONFIG_BLK, 
   CONNECTION=CLRTST_2012, KEYS=2, $



MFD After:
 SEGNAME=HSACC_CONFIG_BLK, TABLENAME=CLARITY.ACC_CONFIG_BLK, 
   CONNECTION=CLRPRD, KEYS=2, $



You can download a Windows port of SED here (http://gnuwin32.sourceforge.net/packages/sed.htm) and read more about it's capabilities here: http://ss64.com/bash/sed.html

- ABT

This message has been edited. Last edited by: ABT,


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
February 07, 2013, 03:30 PM
susannah
looks like a pretty handy tool.
You're American Ballet Theatre, right? well...that's your handle from now on Smiler




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
February 08, 2013, 09:05 AM
ABT
I've got a Susannah name! Me and Frankie Martini are in the same club. Wink


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro