January 27, 2006, 07:20 PM
Govind JujareHow 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 ?
January 28, 2006, 12:10 AM
susannahin 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 codeJanuary 30, 2006, 11:04 AM
Carol Dobsonor 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.
January 30, 2006, 11:30 AM
Robin LovellIn 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 JujareI am on Unix/Solaris. 'STATE' worked out for me. Thx.
February 08, 2006, 02:59 PM
jbmuirAlternatively,
-UNIX ls /path/to/your/file 1>/dev/null 2>/dev/null
-IF &EXITRC NE 0 THEN GOTO WHATEVER;