Focal Point
[CLOSED] Application Name Inside a FEX file

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

September 19, 2012, 12:56 PM
Ramkumar - Webfous
[CLOSED] Application Name Inside a FEX file
Is there a way I can get the Application name inside a FEX file.. Any amper vaiables? I tried to see all the & variables using -? & . But I am not seeing any amper variable with the name of the application in which the FEX is residing...

Is there a way to do this ?

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


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
September 19, 2012, 01:30 PM
Severus.snape
Hi,

Here is one way of doing it..
-SET &LENX=&FOCFOCEXEC.LENGTH-1;

-SET &FEX1=TRIMV('L',&FOCFOCEXEC,&FOCFOCEXEC.LENGTH,'_',1,'A&LENX.EVAL');
-SET &LEN=&FEX1.LENGTH;
-SET &LEN1=&LEN-4;
-SET &FEX= GETTOK(&FEX1, &LEN, 1, '.', &LEN1,'A&LEN1.EVAL');

WHENCE &FEX FOCEXEC

-EXIT

Very crude way I know...
another option is to loop through all the folders in APP PATH using APP QUERY and filter the filename with the current fex file.
Cant seem to think of any easy way ..

thanks
Sashanka


WF 7.7.03/Windows/HTML,PDF,EXL
POC/local Dev Studio 7.7.03 & 7.6.11
September 19, 2012, 01:50 PM
Francis Mariani
The problem with using the WHENCE command in this manner is that the result is not in an amper variable.


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
September 19, 2012, 01:54 PM
Ramkumar - Webfous
Sashanka/Francis, Thanks for the timely replies.

I just need the name of the application alone eg. baseapp - that too in an amper variable. Is there a specific way to do this ?

Thanks, Ram.


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
September 19, 2012, 02:25 PM
Francis Mariani
The answer may be here: Is it possible?


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
September 19, 2012, 02:30 PM
Dan Satchell
Here's one approach. FOCUS output can be captured in a file, which can then be -READ. In this case &LOCATION will contain the complete path, so you will need to parse the value to get just the APP folder name. The command SET EMPSRV=ON returns FOCUS output to the user's screen.
APP FILEDEF EMGFILE DISK EMGFILE.TXT
SET EMGSRV=FILE
WHENCE <fexname> FOCEXEC
-RUN
-*
-READ EMGFILE, &LOCATION
-TYPE &LOCATION
-*
SET EMGSRV=ON
-RUN



WebFOCUS 7.7.05
September 19, 2012, 02:37 PM
Francis Mariani
Nice! Must look into EMGSRV. Thanks Dan. My solution was from 2007. so I'm glad we've made progress!

This message has been edited. Last edited by: Francis Mariani,


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
September 19, 2012, 03:14 PM
Dan Satchell
@ Francis - not sure I would call it progress. I think new system variables (&FOCAPPNAME and &FOCAPPINCLUDE) containing the name(s) of the application folder(s), or a way to easily capture the output from the WHENCE command in a variable would be progress.


WebFOCUS 7.7.05
September 19, 2012, 03:59 PM
Francis Mariani
Absolutely agree, but your solution took less lines than mine, so...


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
September 19, 2012, 04:24 PM
Dan Satchell
In reality, I made no progress with my suggested solution. I discovered it is not working. The path displayed by my code is actually the output from the WHENCE command and not the contents of variable &LOCATION. Don't know what the problem is.

But this variable might be the solution!

&IBIAPP_app



WebFOCUS 7.7.05
September 19, 2012, 04:28 PM
Mighty Max
I think &IBIAPP_app only works if you are passing it in the WebFocus Client -> Custom Settings.


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
September 19, 2012, 04:43 PM
Francis Mariani
As far as I can tell, &IBIAPP_app is used to tell WF where a fex is (particularly if it's not in the app path, but in some other app folder), but cannot use it to find out where a fex is.

Back to 2007.


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
September 19, 2012, 04:46 PM
Dan Satchell
EMGSRV appears to capture error messages only. Since standard output from WHENCE is not an error, it is not captured by EMGSRV.


WebFOCUS 7.7.05
September 19, 2012, 06:03 PM
Waz
EMGSRV notoriously will not capture this sort of thing, went through this process with APP SHOWPATH, and it gets nothing.

There is another possibility, that has been posted here before, and that uses tracing to capture the results of the commands like WHENCE.

e.g.
-*******************************************************************************
-* Set the trace file

-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
WHENCE MyFex FOCEXEC
-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


But you will end up with the same situation as using the SYSFILES technique.

I think SYSFILES may be the best solution.


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!

September 20, 2012, 03:45 AM
Wep5622
This seems similar to the problem in determining which WebFOCUS client you're running your procedures on: Just as with the current application directory, there's no amper-variable containing the hostname of the client.

Interestingly enough, WebFOCUS adapter names can be determined using SYSFILES, SYSCOLUM and as many nested -REMOTE calls as you have servers chained after one another.


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 :
September 20, 2012, 10:21 AM
Francis Mariani
Wep, the Host Name is available in the HTTP Header variables that you can add in the Custom Settings via the Admin Console. Here's a page from the Security and Admin manual:

WebFOCUS Security and Administration > Manipulating WebFOCUS Variables > HTTP Header Variables Available for Script Processing


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
September 24, 2012, 05:08 PM
Ramkumar - Webfous
Thanks for all the information. I will try both EMGSRV and Whence... IBIAPP_app is not working as required...


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
September 25, 2012, 03:13 PM
susannah
-TYPE &IBIMR_domain &IBIAPP_app
If your fex is in a domain, then the &IBIAPP_app will return the app path that you've designated for that domain, it can contain several apps

Try this is 2 steps
1) get a list of all the apps
2) loop thru the apps one at a time listing all the fexes.
stop when you find the fex you want, and grab the app.

APP LIST HOLD
TABLE FILE FOCAPPL
WHERE APPNAME NOT LIKE 'ibi%'
WHERE APPNAME NOT LIKE '/%'
PRINT *
END...
have a look at this, and hold the bits you want.
eg: PRINT APPNAME BY APPNAME NOPRINT ON TABLE HOLD AS MYLIST1 FORMAT ALPHA
then
-READ MYLIST1 NOCLOSE &MYAPP.A64
and...
APP QUERY &MYAPP HOLD
TABLE FILE FOCAPPQ
PRINT *
..some filter for whatever fex you'r elooking for
...
experiment with these commands
APP LIST, making its FOCAPPL file
and
APP QUERY, making its FOCAPPQ file
and if you wanted masters, then
TABLE FILE SYSTABLE

...this should do it.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID