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  iWay Software Product Forum on Focal Point    [CLOSED] Calling DOS batch file and using return code

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Calling DOS batch file and using return code
 Login/Join
 
Member
posted
I have written a DOS batch file that will create backups of my SQL Server databases and save them off into appropriate directories. If the backup works correctly, then the next process should be kicked off.

After playing around some, I was able to create an iDM procedure that called the batch file. The procedure is pretty simple. It only has the following two lines...

-SET &BACKUP='"' | &&ENV_DATA || '\SCRIPTS\backup_databases.bat"';
DOS &BACKUP


The ENV_DATA is a variable that is set in the edasprof file. In our test environment, the variable is then overridden in the user profile so that each developer can have their own environment setup.

Anyway, this seems to work fine. I had some issues at first getting the batch file to work correctly when it was called from iDM (had to do with the path). Now, I want to be able to capture the return code and use it. If the backup was successful, then the next process should be called. If it wasn't successful, then don't call it (well, probably call an error routine instead).

How do I capture the return code from the DOS batch file that I called?

Thanks

This message has been edited. Last edited by: <Kathryn Henning>,


iDM 7.7.05
WebFOCUS 7.7.05
Windows, All Outputs
 
Posts: 11 | Registered: May 25, 2012Report This Post
Guru
posted Hide Post
Try using &RETCODE.


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report This Post
Member
posted Hide Post
Someone else pointed me towards using SYSTEM. That is what you need if you want to be able to capture the return code. However, I am still having issues. I am able to call the DOS batch script, but it always seems to give me a return code of 0. So, I wrote the following simple iDM procedure and DOS batch files...

The iDM procedure is...
-SET &RETCODE = SYSTEM(25,'e:\SCRIPTS\test.bat AFTER','D4');
-TYPE #### Return Code: &RETCODE

The batch file being called (which is on the DM server) is...
ECHO Starting batch file
if (%1)==(BEFORE) EXIT /B 1
if (%1)==(AFTER) EXIT /B 2
ECHO No parameters
EXIT /B 0

Since the batch file is being passed AFTER as a parameter, I am expecting (hoping) to see a return code of 2. I keep seeing a return code of 0. I have tried it with and without the /B parameter on the exit statement in the DOS batch file. The batch file seems to be taking the correct path. The output shows that it is exiting because the parameter was AFTER. Here is the console log...

02/12/2014 14:14:21 DANL-DEV C:\ibi\srv77\dm\edatemp\ts000011>ECHO Starting batch file
02/12/2014 14:14:21 DANL-DEV Starting batch file
02/12/2014 14:14:21 DANL-DEV C:\ibi\srv77\dm\edatemp\ts000011>if (AFTER) == (BEFORE) EXIT /B 1
02/12/2014 14:14:21 DANL-DEV C:\ibi\srv77\dm\edatemp\ts000011>if (AFTER) == (AFTER) EXIT /B 2
02/12/2014 14:14:21 DANL-DEV #### Return Code: 0

Anyone have any ideas on why I am not seeing the number that is being set in the EXIT?


iDM 7.7.05
WebFOCUS 7.7.05
Windows, All Outputs
 
Posts: 11 | Registered: May 25, 2012Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [CLOSED] Calling DOS batch file and using return code

Copyright © 1996-2020 Information Builders