Focal Point
[CLOSED] CHECK FILE for a file on DISK (not on WebFOCUS server).

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

October 26, 2011, 01:22 PM
ABT
[CLOSED] CHECK FILE for a file on DISK (not on WebFOCUS server).
Can someone provide me a pointer as to why this is not working? I can find lots of info on CHECK FILE holdname HOLD, but not any on named DISK locations. I'm sure this is something simple, can someone point me right?

In a nutshell, this accepts 4 parameters from a querystring (one being &HTMNAME), and writes a file in that location. (this all works perfectly). Before doing that write, I'd like to make sure the file doesn't already exist. This seems to be giving me some fits. Any ideas?

Alternately, how would you read a return code from a DOS command (such as DIR-ing it)? Rather not go that way, but if I have to.....

APP HOLD HELDFILES
APP HOLDMETA HELDFILES
APP HOLDDATA HELDFILES

-SET &RPTNAME = '\\server\share$\folder\' | &HTMNAME ;

FILEDEF BOEFINAL DISK "&RPTNAME"



-IF &LINES GT 0 THEN WRITEFILE ELSE NOWRITE;
-CONTINUE




-WRITEFILE
DEFINE FILE CAR
	ORDER/A1     = '1';
	OUTLINE/A300 = '<!-- Report: &RPTTITLE -->';
END

TABLE FILE CAR
PRINT
	ORDER
	OUTLINE

BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS BT_TEMP_1
END



DEFINE FILE CAR
	ORDER/A1     = '2';
	OUTLINE/A300 = '<!-- CUID:   &CUID     -->';
END

TABLE FILE CAR
PRINT
	ORDER
	OUTLINE

BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS BT_TEMP_2
END



DEFINE FILE CAR
	ORDER/A1     = '3';
	OUTLINE/A300 = '<meta HTTP-EQUIV=''REFRESH'' content=''0; url=http://server.com:8080/CrystalReports/viewrpt.cwr?cmsname=mycms.com:6400&|id=&RPTID&|apsuser=username&|apspassword=password&|apsauthtype=secEnterprise''>';
END

TABLE FILE CAR
PRINT
	ORDER
	OUTLINE

BY COUNTRY NOPRINT
WHERE RECORDLIMIT EQ 1;
ON TABLE HOLD AS BT_TEMP_3
END




TABLE FILE BT_TEMP_1
PRINT
	ORDER
	OUTLINE

ON TABLE HOLD AS BT_OUT

MORE
FILE BT_TEMP_2

MORE
FILE BT_TEMP_3

END




TABLE FILE BT_OUT
PRINT
OUTLINE
BY ORDER NOPRINT
ON TABLE HOLD AS BOEFINAL FORMAT ALPHA
END
-GOTO THEEND




-NOWRITE
-HTMLFORM BEGIN

<html>
<body>

<h1>File Exists, Exiting</h1>

<body>
<html>

-HTMLFORM END
-GOTO THEEND



-THEEND

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


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 26, 2011, 04:53 PM
Waz
STATE will test for the existance of a file.

You can test for the results with &RETCODE.


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!

October 26, 2011, 09:29 PM
ABT
Waz,
I've looked through several of the manuals and searched the site and web for State, but keep getting results about all the states (i.e. municipalities) that are deploying WebFOCUS. Can you point me to some documentation?

I also found this (http://solution.ibi.com:8080/91591076.html) earlier today, but it looks like it deals with VMS (even though it is identified as a WinNT related item).

Sorry to be so needy.

- ABT

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


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 26, 2011, 09:54 PM
Waz
I think STATE is an OS command.

Works on Windows and Unix.

http://documentation.informati...ource/test_debug.htm

We use it without the OS call DOS, UNIX.


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!

October 26, 2011, 10:12 PM
ABT
Do you know of any issues with it reading from UNC's? I am looking at a directory with three files that all exist and when I try them, I get that they do not exist.

-SET &RPTNAME = '\\caperomain\EpicReports$\ABT\This File.htm';

DOS STATE "&RPTNAME"
-EXIT


Reply
------------------------------------------------

No HTML Output!

------------------------------------------------

 File doesn't exist


Kinda feeling a little like I'm in the twilight zone.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 26, 2011, 10:20 PM
Waz
I'm not aware of any issues, but test, test, test, to be sure.


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!

October 26, 2011, 10:22 PM
ABT
Looks like I'm not the only one: http://forums.informationbuild...71057331/m/586109863

So looks like I'm going to plan B. No UNC support, iffy support for mapped drives, better support for files in APP PATH (a bridge I am not willing to cross for this). sigh. deflated.

- ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 27, 2011, 04:51 AM
Kofi
ABT,

I have fex that I use to capture config files that use check to see config backup folder exist first. I include here as you might find useful the method?

Kofi

-* File capture_config77.fex
-* -SET &InstDir  = EDIT(&&EDACONF,'999999');
-SET &InstDir  = GETTOK('&APPROOT.EVAL', &APPROOT.LENGTH, 1, '\', &APPROOT.LENGTH, 'A&APPROOT.LENGTH')||'\'||GETTOK('&APPROOT.EVAL', &APPROOT.LENGTH, 2, '\', &APPROOT.LENGTH, 'A&APPROOT.LENGTH');
-SET &ConfRoot = &InstDir || '\config_files';
-RUN
CMD IF EXIST &ConfRoot.. DEL &ConfRoot.. /S /Q
-RUN
CMD IF NOT EXIST &ConfRoot..\WebFOCUS77\Client\wfc\etc   MKDIR &ConfRoot..\WebFOCUS77\Client\wfc\etc
CMD IF NOT EXIST &ConfRoot..\WebFOCUS77\ReportCaster\cfg MKDIR &ConfRoot..\WebFOCUS77\ReportCaster\cfg
CMD IF NOT EXIST &ConfRoot..\WebFOCUS77\Config           MKDIR &ConfRoot..\WebFOCUS77\Config
CMD IF NOT EXIST &ConfRoot..\WebFOCUS77\Utilities        MKDIR &ConfRoot..\WebFOCUS77\Utilities
CMD IF NOT EXIST &ConfRoot..\WebFOCUS77\Utilities\SetEnv MKDIR &ConfRoot..\WebFOCUS77\Utilities\SetEnv
CMD IF NOT EXIST &ConfRoot..\Srv77\etc                   MKDIR &ConfRoot..\Srv77\etc
CMD IF NOT EXIST &ConfRoot..\Srv77\bin                   MKDIR &ConfRoot..\Srv77\bin
-RUN
-SET &&EDACLNT = &InstDir || '\WebFOCUS77';
-SET &&RPTCAST = &InstDir || '\WebFOCUS77\ReportCaster';
-* Client Server
-SET &CgiVars = &&EDACLNT || '\client\wfc\etc\cgivars.wfs';
-SET &CltSite = &&EDACLNT || '\client\wfc\etc\site.wfs';
-SET &CltOdin = &&EDACLNT || '\client\wfc\etc\odin.cfg';
-SET &MrRealm = &&EDACLNT || '\config\mrrealm.cfg';
-SET &RealmUt = &&EDACLNT || '\utilities\realm\realmutil.bat';
-SET &RealmMi = &&EDACLNT || '\utilities\realm\realmmigrate.bat';
-SET &UserVar = &&EDACLNT || '\utilities\setenv\utiluservars.bat';
-* Report Caster Server
-SET &DServer = &&RPTCAST || '\cfg\dserver.xmls';
-* EDA Server
-SET &Edaprof = &&EDACONF || '\etc\edasprof.prf';
-SET &EdaOdin = &&EDACONF || '\etc\odin.cfg';
-SET &EdaServ = &&EDACONF || '\bin\edaserve.cfg';
-RUN
-*
CMD copy &CgiVars &ConfRoot..\WebFOCUS77\Client\wfc\etc
CMD copy &CltSite &ConfRoot..\WebFOCUS77\Client\wfc\etc
CMD copy &CltOdin &ConfRoot..\WebFOCUS77\Client\wfc\etc
CMD copy &MrRealm &ConfRoot..\WebFOCUS77\Config
CMD copy &RealmUt &ConfRoot..\WebFOCUS77\Utilities
CMD copy &RealmMi &ConfRoot..\WebFOCUS77\Utilities
CMD copy &UserVar &ConfRoot..\WebFOCUS77\Utilities\SetEnv
CMD copy &DServer &ConfRoot..\WebFOCUS77\ReportCaster\cfg
-*
CMD copy &Edaprof &ConfRoot..\Srv77\etc
CMD copy &EdaOdin &ConfRoot..\Srv77\etc
CMD copy &EdaServ &ConfRoot..\Srv77\bin
-RUN



Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
October 27, 2011, 06:44 AM
ABT
My target directory is not in the APPROOT.

-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
October 27, 2011, 08:11 AM
Kofi
ABT,

I am knowing that but the principle for check is same. e.g. you need check using CMD IF EXIST "&RPTNAME".

I not give solution just idea of possible method.

Kofi


Client Server 8.1.05: Apache; Tomcat;Windows Server 2012
Reporting Server 8.1.05; Oracle; MS SQL; Windows Server 2012
October 27, 2011, 10:06 AM
DavSmith
ABT, check this link.



In FOCUS since 1985 - WF 8.009/8.104 Win 8 Outputs: ALL of 'em! Adapters: Sql Server Teradata Oracle
October 27, 2011, 04:37 PM
Waz
I just tested a UNC file with STATE and it works OK.

Could your issue be with privileges from the WebFOCUS servers point of view ?

Can you DIR the location or the file ?


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!

October 27, 2011, 09:28 PM
ABT
Thanks Everyone for your help. This is working:

-*Works!!!
-SET &RPTNAME = '\\server1\EpicReports$\ABT\THIS FILE1.HTM';

-*Works!!!
-*-SET &RPTNAME = '\\server2\d$\temp\' | &HTMNAME;

-TYPE &|RPTNAME = &RPTNAME


CMD STATE &RPTNAME
-RUN


-IF &RETCODE EQ 0 GOTO FOUND ELSE GOTO NOTFOUND;

-FOUND
-TYPE &RPTNAME Exists &|RETCODE = &RETCODE
-GOTO DONE

-NOTFOUND
-TYPE &RPTNAME Doesn't Exist &|RETCODE = &RETCODE
-GOTO DONE


-DONE
-EXIT



------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro