Focal Point
[SOLVED] Capturing the APP path

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

August 20, 2014, 05:40 PM
j.gross
[SOLVED] Capturing the APP path
Is there a way to gain programmatic access to the output of APP SHOWPATH?

I am trying to use the search order set up by EDASPROF to control which version of a fex file will be fetched by -INCLUDE

But I find that execution of a fex in a particular app folder (via "Run" in Dev Studio) magically prepends that folder to the app path that is set in edasprof.prf; I want to sense that situation and modify the app path to undo that magic.

So, is there a way to capture the app search list, so that I can feed the list to dialog manager or TABLE?

This message has been edited. Last edited by: <Kathryn Henning>,


- Jack Gross
WF through 8.1.05
August 20, 2014, 05:58 PM
Waz
This is frustrating.


I found an elegant way to do this, but didn't document it.

The only othere suggestion is to use the Trace file technique.

-SET &TEMPPATH = TEMPPATH(80,'A80');
-SET &TSCOM    = GETTOK(&TEMPPATH,80,-2,'/',8,'A8');
-SET &TRACEFL  = &TEMPPATH || ('cmd_op.trc');

-*******************************************************************************
-* Set Commands To Set Tracing

SET TRACEOFF  = ALL
SET TRACEON=R1H
SET TRACEUSER = ON
SET TRACEUSER = &TRACEFL

-RUN

APP SHOWPATH

-RUN
-RUN
-* The previous two -RUN's must be there for this to work.
SET TRACEOFF  = ALL
SET TRACEUSER = OFF
-RUN

-*******************************************************************************
-* Allocate The Trace File
FILEDEF TRACEFIL DISK &TRACEFL

-RUN

-*******************************************************************************
-* Write out a master to read the TRACEFIL list
EX -LINES 4 EDAPUT MASTER,TRACEFIL,CV,FILE
FILENAME=TRACEFIL, SUFFIX=FIX,$
SEGNAME=TRACEFIL, $
  FIELD=LINE ,ALIAS=  ,A500 ,A500 ,$

-RUN

-*******************************************************************************
-* Process the trace file to get the results of the command.

DEFINE  FILE TRACEFIL
 Item3/A20     = GETTOK(LINE,500,3,' ',20,'A20') ;
 MSG_Item/A493 = SUBSTR(500,GETTOK(LINE,500,2,'"',500,'A500'),8,500,493,'A493') ;
 CMD_Flag/A1   = IF EDIT(MSG_Item,'9') EQ ':' THEN 'Y' ELSE 'N' ;
END

TABLE   FILE TRACEFIL
 PRINT  
        MSG_Item

 WHERE        Item3    EQ 'NGtrEvnt:'

-* ON     TABLE HOLD AS TMP_CHCK

END

-RUN




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!

August 21, 2014, 04:56 AM
Ram Prasad E
APP PREPENDPATH or APP APPENDPATH may be one solution.

Thanks,
Ram


WebFOCUS 8.1.05
Windows
http://ibiwebfocus.wordpress.com
https://www.facebook.com/groups/ibi.webfocus/
August 21, 2014, 08:15 AM
Ian Dalton
We have different profiles for development test users as opposed to non-test. These profiles contain statements like.....
APP MAP DEVSETT D:\DEV\SETTLEMENT
APP MAP DEVDCF D:\DEV\DCF
APP MAP DEVQMON D:\DEV\QMON
APP MAP DEVMAND D:\DEV\MANDATE
APP MAP DEVFCSE D:\DEV\FCSETT
APP MAP DEVMIR D:\DEV\MIREPS
APP MAP DEVARCS D:\DEV\ARCSREPS
-RUN

APP PREPENDPATH DEVSETT DEVDCF DEVQMON DEVMAND DEVFCSE DEVMIR DEVARCS

This ensures that the correct version of a program is made available to the correct users. Works well. EDASPROF has the standard path.


_______________________
*** WebFOCUS 8.1.05M ***
August 21, 2014, 10:37 AM
George Patton
Cripes - If Jack and Waz have a problem it must be a challenge indeed...

Susannah? Tony? Wep? FocWizards all ?

Ram and Ian I think have misunderstood Jacks question.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
August 21, 2014, 10:44 AM
susannah
applause, Waz.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
August 21, 2014, 11:12 AM
Wep5622
Are you saying that running a procedure from Dev Studio overrides what you specify with APP PREPENDPATH in your fex? That would be a bit disturbing...

If not, APP PREPENDPATH seems to be the right solution to force a specific order under specific conditions. If that depends on who's using the report, then Ian's idea about user profiles looks like a good approach.

If you really need to find out the path: The server admin interface has a screen where you can alter the path search order. Obviously that requires that the code responsible for that screen must be able to obtain the current path somehow. That seems a good place to have a peek and see what code is underneath.


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 :
August 21, 2014, 11:55 AM
susannah
yes indeed, running a backend fex , regardless of how launched, always sets its own app at the front of the path set by the edasprof, [for the duration of the fexecution, of course]. Try it... go to some app that is not on path, and just do an APP SHOWPATH, and you'll see.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
August 21, 2014, 11:58 AM
Francis Mariani
quote:
fexecution

OK, I love this word!

I wonder if someone at IBI will get upset over it?


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
August 21, 2014, 01:01 PM
Tony A
I would have done something similar to that suggested by Waz.

Time for the thinking cap?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 21, 2014, 01:11 PM
Tony A
If you use ? PATH instead of APP SHOWPATH you can get hold of what is the PREPENDPATH (or the app folder from which you are running the fex) and the actual full path (!) of the app folders in APP PATH.

You can still use Waz's base code but just exchange APP SHOWPATH for ? PATH.

Just depends on what you want out of it?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 21, 2014, 04:37 PM
j.gross
Sorry, I was detained elsewhere. Thanks for all the responses.

Yes, I discovered the hard way what Susannah already knew.

My scenario was, I have test scripts for running a bunch of reports with a variety of options, and supporting scaffolding (common code), all in a Test app folder, and the candidate code for move up the ladder towards production in a separate Prod folder. I put hooks in the main fex of each report (-INCLUDE preface.fex near the top, and -INCLUDE postscript.fex at bottom) with the intention of having do-nothing fex members of those names in the Prod folder, and Do-Something-Interesting instrumentation code in the copies in Test.

I figured I could toggle the APP PATH statement in edasprof, to alter the search path order, and hence toggle between instrumented and pristine production mode. But the scheme failed, because the script fexes to exercise the reports were located in Test, so Test always won.

I bit the bullet, and segregated the scripts in their own app folder, and all is well.

Now I have to figure out what Warren wrote.

-Jack, down in Richmond (where gas is $3.069/gal!)
August 21, 2014, 04:57 PM
j.gross
Waz --

I just had to change 8 to 7 in the SUBSTR (WF 8 change in layout?), and it works like a charm. Very sweet.

Thx
-Jack
August 22, 2014, 09:33 AM
George Patton
Jack - Are you complaining about gas (petrol) prices - or bragging that they are so low?

You're paying 81 cents a litre ... here it's around $1.30 and in Europe more or less twice as much .. Frowner


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
August 22, 2014, 10:22 AM
Tony A
Currently equivalent to $2.30 a litre in the UK for unleaded and a little more for diesel.

@ Jack, are you only running stuff in the apps folders?

If you are running in content folders then you should be able to affect the APP PATH in the content folder properties (or even the focexecs).

I've done that on sites where they didn't have a separate UAT environment and I wanted to control what repositories UAT could access whilst allowing developers access to dev, uat, test and prod repositories. Of course in prod they could only access prod.

Achieved by using identical focexecs in relevant app folders as per your ideal.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
August 22, 2014, 12:05 PM
j.gross
@Tony -

Yes, no MR ("Content folders") involved in this project.

Not to say that all my ideas are ideal.


- Jack Gross
WF through 8.1.05
August 22, 2014, 04:14 PM
j.gross
quote:
Originally posted by George Patton:
Jack - Are you complaining about gas (petrol) prices - or bragging that they are so low?


Surprised how low it's dropped Big Grin


- Jack Gross
WF through 8.1.05
August 24, 2014, 05:39 PM
Waz
Send some down this way....


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!

August 26, 2014, 09:14 AM
dhagen
TABLE FILE _EDAHOME/CATALOG/SYSAPPS
SUM MAX.APPFULL BY APPFULL
END  



"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
August 28, 2014, 04:33 PM
Alan B
Ah, dhagen, this does capture the path in effect at any one time. This is really good, and seemingly accurate. For a bit more detail:
TABLE FILE SYSAPPS
PRINT APPFULL AS 'Application Name'
      APPLOC  AS 'Location'
      APPNEST AS 'Nested'
      DIRPAR  AS 'Parent'
      APPPPRF AS 'Set in Profile'
BY APPNUMP AS 'Path Sequence'
WHERE APPNUMP GT 0
END

See the differences when run from Server and from Dev. Studio.


Alan.
WF 7.705/8.007
August 29, 2014, 03:23 PM
<FreSte>
Alan,

Thanks a lot for emphasising the difference when running this
fex from the server or from DevStudio.

This is exactly what I was looking for. Good One


Cheers

-Fred-
September 04, 2014, 10:26 AM
j.gross
Thanks all.

Allow me to guild the lily, by showing the folder description (APPDESC):
TABLE FILE _EDAHOME/CATALOG/SYSAPPS
PRINT APPFULL AS 'Application Name'
      APPDESC AS 'Description'
      APPLOC  AS 'Location'
      APPNEST AS 'Nested'
      DIRPAR  AS 'Parent'
      APPPPRF AS 'Set in Profile'
BY APPNUMP AS 'Path Sequence'
WHERE APPNUMP GT 0;
END


What is the source for APPDESC? The first line of profile.fex, in the respective APP folder.
For example, baseapp\profile.fex starts with
-*FEX_DESCRIPTION=Default Directory: Files Always Available
, so "Default Directory: Files Always Available" is the reported value for the BASEAPP folder.


- Jack Gross
WF through 8.1.05