Focal Point
How to check the existence of a file from within WebFOCUS Fex Code

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

January 27, 2006, 07:20 PM
Govind Jujare
How to check the existence of a file from within WebFOCUS Fex Code
I remember there was a trick to check the existence of a disk file (by using WebFOCUS Fex Code).
I am not able to recollect what was the exact syntax .... does anybody know ?


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
January 28, 2006, 12:10 AM
susannah
in a windows environment you can
CMD STATE D:\IBI\APPS\..\filename.ext
-RUN
-IF &RETCODE NE 0 THEN you got no file.
also there was an interesting post by jg
and he says
!IF EXIST C:\ibi\apps\baseapp\NEWXHT.XLS (DEL C:\ibi\apps\baseapp\NEWXHT.XLS /F)
 
here's the link to that code




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
January 30, 2006, 11:04 AM
Carol Dobson
or you can use the old DOS STATE

-* Note: zero is a good return code
DOS STATE \\IMPRS01\APPS\PMS\DATA\FTFLAG.DAT
-IF &RETCODE NE 0 GOTO NOFLAG;

then add appropriate labels and loop.



WebFOCUS 7.6.6/TomCat/Win2k3
January 30, 2006, 11:30 AM
Robin Lovell
In the Unix/Linux environment, just use 'STATE' without the preceding CMS/DOS/etc. qualifier.
STATE filename.txt
-RUN
-IF &RETCODE EQ 0 GOTO FILEOK ;
-TYPE Error message
-GOTO ERREXIT

-FILEOK
... Rest of fex here
January 31, 2006, 09:12 PM
Govind Jujare
I am on Unix/Solaris. 'STATE' worked out for me. Thx.


WebFOCUS 5.3.3 MRE - Solaris - Sun Web Server - Weblogic
February 08, 2006, 02:59 PM
jbmuir
Alternatively,

-UNIX ls /path/to/your/file 1>/dev/null 2>/dev/null
-IF &EXITRC NE 0 THEN GOTO WHATEVER;


WF 7.1.6 moving to WF 7.7, Solaris 10, HTML,PDF,XL