Focal Point
Test if a file exist

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

April 16, 2007, 10:45 AM
Delphine
Test if a file exist
Sorry for my english, it is not very good.

I try to test if a file exist in the way of conditionning my prodecure (focus format : UFILE for example). I don't find the solution in my books.

Can you help please?
April 16, 2007, 10:57 AM
jgelona
Use the STATE command, then check &RETCODE. It will be 0 if the file exists or -1 if it does not exist.

STATE pathname/car.foc
-RUN
-IF &RETCODE NE -1 THEN GOTO SKIP_CREATE;
-*
CREATE FILE CAR
-RUN
-SKIP_CREATE


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
April 16, 2007, 11:19 AM
Francis Mariani
Interesting.

I couldn't find the STATE command in my WF 5.3.2 documentation.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 16, 2007, 11:39 AM
Alan B
In 7.1.3 docs, Developing Reporting Applications, it gets a very minor role with &RETCODE on page 6-91! Initially it was DOS STATE, but STATE works now.

It is a v. useful command.


Alan.
WF 7.705/8.007
April 16, 2007, 11:42 AM
Francis Mariani
Is STATE an operating system command? I've just run it on a Windows PC and a UNIX server., but I don't think this will work on a MVS system. You may need to use

-? TSO DSNAME 'FOCUS.DB.NAME' and then check &RETCODE.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 16, 2007, 12:33 PM
Alan B
I think that STATE was VM (am getting old and forgetful) and ported to PC and thence Unix, so would not work on MVS, maybe not on AS400 either.


Alan.
WF 7.705/8.007
April 17, 2007, 04:03 AM
Delphine
Thanks. The idea appeal to me.... but the STATE command does not exist :
" (FOC1517) COMMANDE NON RECONNUE STATE UPNBCE1"

They don't install all the functionnality of WF
Version : 526
Gen : 061804

Confused
April 17, 2007, 04:15 AM
Delphine
Thanks for the command.
"-? TSO DSNAME 'path/dsname' "

My procedure is OK.

Thank you very much

Smiler
April 17, 2007, 06:27 AM
Danny-SRL
Delphine,

Si STATE n'est pas reconnu et "-TSO DDNAME ..." l'est, cela veut peut-etre dire que le serveur de WebFocus est MVS. Sur ce systeme la commande n'existe pas. Sur les autres (VM, WIN, UNIX, LINUX etc.), oui.
Bon FOCUS!


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

April 17, 2007, 08:23 AM
Delphine
Daniel,

En effet le serveur de WF est MVS .... Par contre sais-tu comment récupérer le path name afin d'éviter de la mettre en dur pour utiliser "-? TSO DSNAME 'path.nomfic' " ?

J'ai essayé ça sur un fichier existant et le DSNAME est à blanc ....
-? TSO DDNAME 'fic'


quote:
Originally posted by Danny-SRL:
Delphine,

Si STATE n'est pas reconnu et "-TSO DDNAME ..." l'est, cela veut peut-etre dire que le serveur de WebFocus est MVS. Sur ce systeme la commande n'existe pas. Sur les autres (VM, WIN, UNIX, LINUX etc.), oui.
Bon FOCUS!

April 17, 2007, 02:20 PM
Tomsweb
Look up the command WHENCE


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
April 17, 2007, 02:27 PM
Tomsweb
More specifically...

check this out...


Good day! Idea


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
April 17, 2007, 02:29 PM
Tomsweb
More specifically, check this out...
<http://techsupport.informationbuilders.com/sps/73531034.html>

Good day!
Idea


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
April 17, 2007, 03:43 PM
ira
'State' tests for the existence of a file or ds. Been using it since back in mainframe focus 3.8 ( sheesh so long ago)...


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
April 17, 2007, 03:56 PM
Francis Mariani
I would guess NOT on MVS Mainframe.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 17, 2007, 04:07 PM
Francis Mariani
Unfortunately the WHENCE command will not really help Delphine, I think she requires a method to retrieve the DSNAME into a Dialogue Manager variable which is then used in the -? TSO DSNAME command, n'est-ce pas?

Normally,
-? TSO DDNAME [i]ddname[/i]
should work, if, of course, the DDNAME in question is actually allocated to the FOCUS session. If the file exists, &DSNAME is populated with the DSNAME, if it does not exist, &DSNAME is set to blank.

Delphine, is it possible that the file is not allocated to the FOCUS session?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 18, 2007, 07:24 AM
Delphine
Exactly! And I can check the DSNAME with -? TSO DDNAME .... I try it but i write it wrongly.... (sorry my english is very bad)...

It's OK now... thanks a lot

quote:
Originally posted by Francis Mariani:
Unfortunately the WHENCE command will not really help Delphine, I think she requires a method to retrieve the DSNAME into a Dialogue Manager variable which is then used in the -? TSO DSNAME command, n'est-ce pas?

Normally,
-? TSO DDNAME [i]ddname[/i]
should work, if, of course, the DDNAME in question is actually allocated to the FOCUS session. If the file exists, &DSNAME is populated with the DSNAME, if it does not exist, &DSNAME is set to blank.

Delphine, is it possible that the file is not allocated to the FOCUS session?

April 18, 2007, 12:11 PM
Francis Mariani
Delphine,

Accent Québécois, Français ou…?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 19, 2007, 04:43 AM
Delphine
Francis,

Française.... Smiler
Si je peux écrire français... chouette...
Au fait .... j'ai un soucis avec -? DSNAME et DDNAME ...!!

La façon dont c'est monté le DSN est créé automatiquement en début d'exécution en batch... à tous les coups il le trouve alors que le master n'est pas créé.... dommage.... ça marchait très bien en intéractif

Have a good day ....
Delphine

quote:
Originally posted by Francis Mariani:
Delphine,

Accent Québécois, Français ou…?

April 19, 2007, 10:34 AM
Francis Mariani
On n'a pas besoin d'un Master pour les commandes -? TSO DSNAME/DDNAME. Pour garder le Master crée par ON TABLE HOLD AS ..., assigner DDNAME HOLDMAST a un PDS existant.

Sorry, my written French is not perfect.

I don't think we need a Master to execute -? TSO DSNAME/DDNAME. To keep a Master created by ON TABLE HOLD AS ..., allocate DDNAME HOLDMAST to an existing PDS.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 20, 2007, 03:12 AM
Delphine
you write french more than me for english.... (oouuuhh lala....)
i find my problem.... i read my file in the beginning of the procedure and at the end i create it "again" ... the problem is that at the beginning the file out is deleted... i change my procedure in the way of using two files ... and it's ok now..

thanks a lot for your help ...

Delphine

quote:
Originally posted by Francis Mariani:
On n'a pas besoin d'un Master pour les commandes -? TSO DSNAME/DDNAME. Pour garder le Master crée par ON TABLE HOLD AS ..., assigner DDNAME HOLDMAST a un PDS existant.

Sorry, my written French is not perfect.

I don't think we need a Master to execute -? TSO DSNAME/DDNAME. To keep a Master created by ON TABLE HOLD AS ..., allocate DDNAME HOLDMAST to an existing PDS.