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] Would like to understand how WINNT commands work

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Would like to understand how WINNT commands work
 Login/Join
 
Member
posted
Hi,

I have the following bit of code at the start of a program that creates a number of files in &MYPATH. The idea being that I want to delete all the files in that folder before I create all the new ones later in the program.

What I'm not sure is if the WINNT del command will complete before the rest of the program runs? If not, is there a way to make sure it does please?

 
-SET &MYPATH          = 'E:\mypath\';

-SET &DELETEFILE = &MYPATH | '*.*';
-RUN
-TYPE &DELETEFILE
-WINNT del /q /f &DELETEFILE
-RUN

The rest of my program here....

 


If there is a chance it won't have finished, I could end up with a mess of files in the folder.

Thanks,

Duncan

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.2
Windows 10
XLSX, PDF
 
Posts: 12 | Registered: August 17, 2017Report This Post
Expert
posted Hide Post
Check out the SYSTEM function. This will populate a variable with the return code of the OS command so that you can test for success/failure before continuing.

Link to online help

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
Hi Tony,

Thanks for the super quick reply. I had a look at the System command but I'm either doing something wrong or it doesn't work on our setup.

These were my two attempts:

   
-SET &RETURNCODE = SYSTEM(29, 'WINNT del /q /f E:\mypath\*.*', 'D4');
-TYPE returncode was &RETURNCODE


-SET &RETURNCODE = SYSTEM(31, 'COMMAND del /q /f E:\mypath\*.*', 'D4');
-TYPE returncode was &RETURNCODE


These are the results:
   
'WINNT' is not recognized as an internal or external command,
operable program or batch file.
returncode was -1


'COMMAND' is not recognized as an internal or external command,
operable program or batch file.
returncode was -1


It's nearly 8pm here so signing off until the morning now.

Cheers,

Duncan


WebFOCUS 8.2
Windows 10
XLSX, PDF
 
Posts: 12 | Registered: August 17, 2017Report This Post
Platinum Member
posted Hide Post
Try
-SET &RETURNCODE = SYSTEM(29, 'del /q /f E:\mypath\*.*', 'D4');
-TYPE returncode was &RETURNCODE


WebFOCUS 8.2.06
 
Posts: 210 | Location: Sterling Heights, Michigan | Registered: October 19, 2010Report This Post
Member
posted Hide Post
Thanks dbeagan, that fixed it Cool

Handling the result?
If I understand the documentation correctly, I should just need to check that I got a value of 0 in &RETURNCODE as processing is suspended until the operation is complete?

Confirm understand of possible return values
Interestingly, even when the file was not found, the value of &RETURNCODE was still 0. Guessing for the SYSTEM command, I get '0' if I have submitted a valid command, regardless of whether if finds any files to delete and '-1' if there if it's an invalid command?


WebFOCUS 8.2
Windows 10
XLSX, PDF
 
Posts: 12 | Registered: August 17, 2017Report This Post
Expert
posted Hide Post
You will get a return code of 0 if the command is valid and the command ran successfully.

If you run your command (on the server remember!) using CMD.EXE then you will get the same response.

If you want to get differing return codes from your call then look at writing a python or powershell procedure to call that will give you more meaningful return codes.

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 Tony,

I think provided I get the 0 once the command has completed, I'm happy to let my program continue. If I get some time, I will explore the powershell option.


WebFOCUS 8.2
Windows 10
XLSX, PDF
 
Posts: 12 | Registered: August 17, 2017Report 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] Would like to understand how WINNT commands work

Copyright © 1996-2020 Information Builders