Focal Point
[SOLVED] System command exit status?

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

February 15, 2011, 09:12 AM
Wep5622
[SOLVED] System command exit status?
I'm trying to check the exit status of a system command, but I can't figure out how. I have this:
-SET &S = '\';
-SET &CMD = &APPROOT || &S || &DIR || &S ||&FILENAME;
-WINNT DEL &CMD


How do I check whether the DEL command succeeded?

I've also tried using SYSTEM(), but for some reason that returns status 1 (what does that even mean?), even though the command should succeed as far as I can tell.
For the record, I used this incantation:
-SET &CMD = 'DEL ' | &APPROOT || &S || &DIR || &S ||&FILENAME;
-SET &RETCODE = SYSTEM(&CMD.LENGTH, &CMD, 'D4');

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


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 15, 2011, 09:16 AM
Wep5622
Never mind, it seems I forgot to prepend the 'DEL ' substring to the &CMD variable in the SYSTEM()-case. That part works now.

Still, it would be good to know how to check the exit status of the first command.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
February 15, 2011, 03:56 PM
Waz
Be careful with &RETCODE, as it is a system variable.


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!