Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Executing .bat from .fex procedure

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Executing .bat from .fex procedure
 Login/Join
 
Member
posted
Hi All,

I tried executing a sample batch script from .fex procedure in Data Migrator.
I have tried all the below mentioned ways of executing it.

1. SET &RETCODE = SYSTEM(33,'C:\Users\bnagaraj\Desktop\xyz.bat','I2')

2. FILEDEF XYZSCR DISK xyzscript.bat

-RUN

-WRITE XYZSCR start "c:\windows\system32" notepad.exe

-CLOSE

DOS xyzscript.bat-RUN

3. DOS C:\Users\bnagaraj\Desktop\xyz.bat

4. CMD C:\Users\bnagaraj\Desktop\xyz.bat

5. !C:\Users\bnagaraj\Desktop\xyz.bat

And the content of my xyz.bat file is
start c:\windows\system32\notepad.exe
exit
In all the above mentioned methods I got the same message in console log

C:\ibi\DEVSTU~1\srv77\wfs\edatemp\ts000036>start c:\windows\system32\notepad.exe
C:\ibi\DEVSTU~1\srv77\wfs\edatemp\ts000036>exit

i.e The contents of my batch file is read but the notepad.exe is not invoked.

kindly help me rectifying this.

Thanks,

Balaji

This message has been edited. Last edited by: <Kathryn Henning>,
 
Posts: 11 | Registered: November 06, 2013Report This Post
Platinum Member
posted Hide Post
Balaji,

Do you have access to execute the .bat file from the location where the .bat file is saved. We run .bat files but we place the .bat file on the actual machine.

Below is an example how we call a .bat file:

  
-WINNT D:\ibi77\wmgtmp\WMBatchPrint.bat


Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats
 
Posts: 121 | Location: California | Registered: June 19, 2008Report This Post
Expert
posted Hide Post
The -SET will actually run the bat job and then wait for the bat job to finish. The actual system return code as a result of the bat job will be placed in &RETCODE (in your example) so you should test the value of that to determine if the bat job suceeded or not.

Just be aware that the bat job will be executed on the reporting server so it will need to be self closing. Running a bat job that opens notepad without a close will just serve to leave bat processes in a wait state on your reporting server. I can guarantee that this will begin to annoy your server people eventually!

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Prodrigu,

I tried using -WINNT. I am getting the same message in the console log.
 
Posts: 11 | Registered: November 06, 2013Report This Post
Platinum Member
posted Hide Post
Hi,

Do you specifically want to call NOTEPAD.EXE?
And if so, what do you want to do with it?

As Tony said - the batch job will run on the "server" process. So NOTEPAD.EXE won't be able to open up interactively in the session, especially from a batch job, even if you have all the WebFOCUS / DataMigrator components running on your local PC.


If all you are trying to do is create an example of a FEX calling a BAT file, then change your BAT file to run something that isn't "interactive" e.g. a COPY command

But, if you specifically want to call NOTEPAD.EXE, then we need to understand what you are trying to accomplish.


WebFOCUS 8.2.06 mostly Windows Server
 
Posts: 195 | Location: Johannesburg, South Africa | Registered: September 13, 2008Report This Post
Member
posted Hide Post
Hi Twanette,

I am new to Data Migrator and I want to know how to call a .bat from a fex.
I have also tried executing a bat which writes a line of text to a text file.
And this is the content of my xyz.bat file
echo Test write >> xyzwrite.txt
When I run this, the contents of the bat file is read and the below mentioned error message id displayed in the console log.
C:\ibi\DEVSTU~1\srv77\wfs\edatemp\ts000011>echo Test write 1>>xyzwrite.txt
But the text "Test write" is not written to the xyzwrite.txt file. It is working fine when I call the bat script from cmd.
 
Posts: 11 | Registered: November 06, 2013Report This Post
Expert
posted Hide Post
Read the "error" message (informative not error) and you will realise why you are not seeing the file contents.

When you run something on the reporting server (as you are in this case) a file not specifically identified via a full path will, by default, be written to the directory from where the CMD is being executed. In this case it is being executed from c:\ibi\devstudio77\srv77\wfs\edatemp\ts000011 so the file xyzwrite.txt will be written to that folder.

The thing to remember about edatatemp is that all files written to this folder during an agent execution are transient in nature. e.g. they will be cleaned up after the agent execution is complete (deleted).

When you are running it interactively via CMD.EXE then your file will be written to the folder that is current in the CMD box prompt. e.g. C:> or C:\users\userid> etc.

Basic DOS and not really WebFOCUS.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Thanks. That was very helpful. I tried executing a simple bat script with a copy command. It works fine.
 
Posts: 11 | Registered: November 06, 2013Report This Post
Expert
posted Hide Post
Just a thought, not sure if it was mentioned above, but are you running this from Dev Studio locally or is this a call to a WebFOCUS server on a different machine ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Executing .bat from .fex procedure

Copyright © 1996-2020 Information Builders