Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Write run-time &Variables to a file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Write run-time &Variables to a file
 Login/Join
 
Platinum Member
posted
Hi all,

I would like to save all my run-time &variables, starting '&V_' to a file. So something similar to what I would get if I issued the following command:

-? &V

I have been reading the following thread where Ginny shows how to output column names to variables. I have tried to modify this code to write my &variables but without any luck.

I also tried the following in hope it would write out the variables, but alas that would have been too easy!

FILEDEF MARK_TEST DISK /home/iadmindev/ibi/apps/mark/test.fex
-RUN

-WRITE MARK_TEST -? &V


Any thoughts?

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


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Platinum Member
posted Hide Post
Are you getting any errors?
Is that syntax correct for the 400?
I think it should look more like...
FILEDEF MARK_TEST DISK library/mark(test)


WebFOCUS 8202 Win 2012
Test - WebFOCUS 8203 on Win 2012
 
Posts: 173 | Registered: November 16, 2005Report This Post
Platinum Member
posted Hide Post
Hi Rich,

This runs fine but will just write '-? &V' to the file within the IFS directory on the 400.

All our system database files are in the normal format library/file.


I can easily manually record all the variables, but I want the code to write all '&V_*' &variables without having to specify each one.


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Expert
posted Hide Post
Mark,

I'm glad you liked my previous post. However, I don't think you can -WRITE the output of a command to a specific file the way you tried.

The output of -? is going to the 'terminal' so I think what you would need to do, shades of old mainframe days, would be to filedef the terminal. Not sure what the ddname is these days. You could try TRMOUT.

So it would be something like this:

FILEDEF TRMOUT DISK whereever_you_want_to_put_it
-? &V

Sound reasonable?


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
Mark,

I've been trying something on my environment (which is NOT as400, but windows).
I think however that is should be possible to modify the code so that it also runs on as400.
My code is as follows:
SET TRACEOFF = ALL
SET TRACEON = ALL
SET TRACESTAMP=OFF
SET TRACEUSER=C:\TEMP\MARK.TRC
-RUN
-? &
SET TRACEOFF = ALL
-RUN
FILEDEF MASTER DISK TRACE.MAS
FILEDEF TRACE DISK C:\TEMP\MARK.TRC
-RUN
-WRITE MASTER FILENAME=TRACE, SUFFIX=FIX
-WRITE MASTER SEGNAME=TRACE
-WRITE MASTER FIELDNAME=LINE, FORMAT=A200, ACTUAL=A200, $
-RUN
DEFINE FILE TRACE
RESULT/A155 = SUBSTR(200,LINE,45,200,155,RESULT);
AMPER/A1 = EDIT(RESULT,'9');
END
TABLE FILE TRACE
PRINT RESULT
IF LINE CONTAINS 'ngput'
IF AMPER EQ '&'
END

On Windows this gives me a report with just the amper variables currently active.
Hope this helps..... and that you can convert it to and use it on the as400.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
GamP, that is very creative! I really like this solution.

For a cross-platform version, I would use the TEMPPATH function to determine where to save the trace file, so with a little tweak for the TRACEUSER setting, this has been tested on UNIX and Windows and works on both.

-SET &ECHO=ALL;

-SET &TEMPDIR = TEMPPATH(60,'A60');
-SET &TRACEFILE = &TEMPDIR || 'trace.trc';

SET TRACEOFF = ALL
SET TRACEON = ALL
SET TRACESTAMP=OFF
SET TRACEUSER=&TRACEFILE
-RUN
-? &
SET TRACEOFF = ALL
-RUN
FILEDEF MASTER DISK trace.mas
FILEDEF TRACE DISK trace.trc
-RUN
-WRITE MASTER FILENAME=TRACE, SUFFIX=FIX
-WRITE MASTER SEGNAME=TRACE
-WRITE MASTER FIELDNAME=LINE, FORMAT=A200, ACTUAL=A200, $
-RUN
DEFINE FILE TRACE
RESULT/A155 = SUBSTR(200,LINE,45,200,155,RESULT);
AMPER/A1 = EDIT(RESULT,'9');
END
TABLE FILE TRACE
PRINT RESULT
IF LINE CONTAINS 'ngput'
IF AMPER EQ '&'
END

Thanks very much GamP.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
You're welcome. Always trying to be of help.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
Post 111 for you GamP - a milestone Smiler


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
Good job, GamP. My suggestion didn't work a lick.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
Very creative GamP...
I will recomend you for a job at Information Builders helpdesk




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Platinum Member
posted Hide Post
Hi all - as always a great effort from everyone!

GamP your solution with Francis's small mod works just right for us, thank you very much! Smiler



Also , if I may sneak in one last query with you all:

Every so often my Developer Studio decides to not allow me to edit a file when I right-click on it. Instead of getting the usual options "Open, Edit, Run, Print, Copy" etc, all I can do is "Run, Copy, Properties". I usually have to restart Dev Studio to get all the options back, but then sometimes it breaks again within minutes - todays has been particularly bad! Our other Developer doesn't have any problems, any ideas what am I doing wrong?! I guess somehow I am loosing my access rights?


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Platinum Member
posted Hide Post
Mark,

Also note that if you want to check if an amper variable exists, you can use the EXISTS function, as in:

-SET &CASTER=IF &DSTSCHEDID.EXISTS EQ 1 THEN 'Y' ELSE 'N';


You may want to put your latest question in a new thread, so that it doesn't get lost.

GamP, very interesting code. Francis, thanks for Unixifying it.

Sean


------------------------------------------------------------------------
PROD: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
TEST: WebFOCUS 7.6.2 on Unix AIX/Tomcat/Servlet Mode
 
Posts: 210 | Location: Ottawa | Registered: November 03, 2005Report This Post
Expert
posted Hide Post
Mark,

I'm assuming that your reporting server is running under OPSYS security as ours is. And are you talking about Data Servers or which area of Dev. Studio. We are all Data Servers and sometimes have that issue. Our users store their operating system credentials in Show Environments. It appears that the cookie disappears or gets corrupted on occasion.

I have a little focexec that I have them run that tells them who is logged on.

-* File check_logon.fex
-*************************************************************
-SET &USERID=GETUSER('A8');
-TYPE THE USERID FROM GETUSER IS &USERID  


Unfortunately, sometimes the right id shows. It is a head-scratcher.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Expert
posted Hide Post
gamps idea is really cool...
if you want a rather pedestrian way, you can take your initial idea and just tweak it a bit
say you have 10 &variables in your fex and you know what they are called...which you should, right?
FILEDEF MARK_TEST DISK /home/iadmindev/ibi/apps/mark/test.fex
-RUN

-WRITE MARK_TEST NOCLOSE &var1
-WRITE MARK_TEST NOCLOSE &var2
-WRITE MARK_TEST NOCLOSE &var3
-WRITE MARK_TEST NOCLOSE &var4
... etc
-CLOSE MARK_TEST
(I'm not sure the CLOSE is right, i use it and it works, but i think i made it up .. that's the thing with Focus, its a language so sometimes you make stuff up and it works!)
The NOCLOSE is important , it keeps from overwriting the same line.. kinda like a FILEDEF..(APPEND
I do this at run time for every one of my fexes..
-WRITE MYFILE &USERID &FEXNAME &DATE &TOD &ARANDOMNUMBER
and then all their &var values
and then MODIFY big log file..(hence the random number)
Big Brother is watching...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Platinum Member
posted Hide Post
quote:
Originally posted by GinnyJakes:
Mark,

I'm assuming that your reporting server is running under OPSYS security as ours is. And are you talking about Data Servers or which area of Dev. Studio. We are all Data Servers and sometimes have that issue. Our users store their operating system credentials in Show Environments. It appears that the cookie disappears or gets corrupted on occasion.

I have a little focexec that I have them run that tells them who is logged on.

-* File check_logon.fex
-*************************************************************
-SET &USERID=GETUSER('A8');
-TYPE THE USERID FROM GETUSER IS &USERID  


Unfortunately, sometimes the right id shows. It is a head-scratcher.


Thanks Ginny, I was refering to the Data Servers. I will have to speak to our Techie and see if can shed some light on it and will check my logon user value when it next happens.


quote:
Originally posted by smiths:
Mark,

Also note that if you want to check if an amper variable exists, you can use the EXISTS function, as in:

-SET &CASTER=IF &DSTSCHEDID.EXISTS EQ 1 THEN 'Y' ELSE 'N';




quote:
Originally posted by susannah:
gamps idea is really cool...
if you want a rather pedestrian way, you can take your initial idea and just tweak it a bit
say you have 10 &variables in your fex and you know what they are called...which you should, right?
…..

Thanks Sean / Susannah,

The great thing about this script is that I don’t want/have to specify each and every run-time variable, it will just dump them out for me. This is necessary as many reports will be making use of it, all with different &variables.

To give more of an insight into its use:

All our reports end with a call to a Log scipt. This updates a log file, with details such as Report_ID, User, Report, Date, Start Time, End Time, Runtime, Rows Returned etc.

I have now coded an option to run this new script ‘ report dump’, if the report is one we want to monitor, or if the number of rows returned exceed a cetain value, or even if a report runs for too long.

This will allow us to be more effective in trying to improve the reports running on the system. Instead of having to email a user and say ‘Your report ran for 15 minutes, what did you enter?’, we can now just find the report dump which is saved under a the Report_ID.

Using a looping method (which is new to me in WebFocus) seen in Ginny’s other thread, I have been able to modify the dump script to divide the &variables into sections, each with headings. Therefore my dump now looks more like:


-* ------------------------------------------------------------------------------------------------------------------
-* Report Dump For ‘Mark Test Report’
-* ------------------------------------------------------------------------------------------------------------------

-* ------------------------------------------------------------------------------------------------------------------
-* LOG VARIABLES:
-* ------------------------------------------------------------------------------------------------------------------

&LOG_USER = ERF
&PROC = _mark_test_report
&RUNDATE = 20071207
&TERRITORY = UK
&LOG_SERVER =
&REP_ID = erf_20071207_111103
&STARTED = 11.11.03
&ENDED = 11.11.04
&RUNTIME = 1
&RETURNED = 102

-* ------------------------------------------------------------------------------------------------------------------
-* GLOBAL VARIABLES:
-* ------------------------------------------------------------------------------------------------------------------

&G_COP = ABC
&G_FORMAT = EXL2K
&G_RCS_INCL = A
&G_SYSTEM = DEVELOPMENT
&G_USER = erf

-* ------------------------------------------------------------------------------------------------------------------
-* PROGRAM VARIABLES:
-* ------------------------------------------------------------------------------------------------------------------

&V_DATE_FROM = 01/11/2007
&V_DATE_TO = 30/11/2007
&V_DRILL_YN =
&V_ENV = D
&V_INCLUDE = N
&V_MONTH =
&V_USER_FROM = ERF
&V_USER_TO = ERF

-* ------------------------------------------------------------------------------------------------------------------
-* USER DEFINED COLUMNS:
-* ------------------------------------------------------------------------------------------------------------------

&C1 = ‘ORDER_NO’
&C2 = ‘ORDER_LINE’
&C3 = ‘PRODUCT_NO’
&C4 = ‘QTY’

-* ------------------------------------------------------------------------------------------------------------------
-* OTHER VARIABLES:
-* ------------------------------------------------------------------------------------------------------------------

&H_IDENTIFIER = 20071207102140
&U_ENV = D
&U_TERRITORY = UK



I am really pleased with it, so thanks again for all your help!


WebFocus 765. iSeries v5r4
 
Posts: 175 | Location: England | Registered: April 11, 2006Report This Post
Member
posted Hide Post
This is a fantastic technique - thank you!

But I have a problem: the "-? &" in it is echoed into the html page and is viewable via "view source". Is there any way of stopping this? I have been searching site.wfs config but I really can't find anything.

Many thanks
Roy


8.0.0.6, Ubuntu 12.04, All
 
Posts: 12 | Location: South Africa | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
GamP , submit this in the Tips & Techniques Comp, its a winner.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
i second Waz's motion...
its a winner, Gamp.
as is Francesco's tweak.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
quote:
But I have a problem: the "-? &" in it is echoed into the html page and is viewable via "view source". Is there any way of stopping this? I have been searching site.wfs config but I really can't find anything.


Any ideas anyone?


8.0.0.6, Ubuntu 12.04, All
 
Posts: 12 | Location: South Africa | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
but see, that's the whole point of turning on the trace...you're trapping the console...if it doesn't appear on the console...it can't be trapped in the trace output.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Thanks susannah but I'm not troubled by actually having the "-? &" command but rather that its result is returned in the html page. When it comes to composing the final page that is returned to the browser there must be a way of stopping the html comment from being included at the end of the displayable part of the page. (i.e. why does console output *need* to be returned to the user?)


8.0.0.6, Ubuntu 12.04, All
 
Posts: 12 | Location: South Africa | Registered: February 07, 2007Report This Post
Expert
posted Hide Post
Roy,

quote:

But I have a problem: the "-? &" in it is echoed into the html page and is viewable via "view source". Is there any way of stopping this? I have been searching site.wfs config but I really can't find anything.


I'm sure you have:
-SET &ECHO=OFF;
so, the source code is not displayed.

Then turn off the right-click option for the HTML page.

Disable Right-Click - Toolbar


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
oh the user is seeing it? i thought it was just under ViewSource that it was being revealed.
how odd.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Expert
posted Hide Post
GamP's technique can also get the results from APP SHOWPATH, I think that was an issue in another post here?

Roy D, if the users are seeing the & output, what are you returning ?

Is it an HTML page or a report.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thanks for all the responses! Just to clarify I have included an edited html page below. It is on "view source" that the amper-variables become visible when you use this technique. My reasoning is that at the final composition of the page .. a function I believe is performed by the WebFOCUS Client .. the {!-- comment --} section is appended to the displayable report ('}' replaces left and right angle bracket). A want to prevent this part being displayed since some amper-variables contain more sensitive data that I don't want savy users having access to. I would have hoped that some configuration setting for the WF Client could altogether stop it from appending the html comment to the end of the page but I don't know what setting that is or whether it in fact exists. There is something in that line on TechSupport as a Technique: How to prevent "View Source" from revealing && variables? However this is not quite there

http://techsupport.informationbuilders.com/sps/10512001.html


How to prevent "View Source" from revealing && variables? Many of these
variables contain sensitive information that should not be displayed to someone
in the view source of html reports.



Solution:




In the /ibi/client53/wfc/etc/default.wfs file, the _ibi_get_ampers variable is
used to issue a '-? &&' command, whenever IBIF_persistentamp is set to "YES":
<if> IBIF_persistentamp.upper EQ "YES"
_ibi_get_ampers=-TYPE <AMPERS>\n-? &&&&\n-TYPE </AMPERS>
<else>

_ibi_get_ampers=\n
<endif>

To prevent this, _ibi_get_ampers can be set to nothing whether
IBIF_persistentamp is set to "YES" or "NO". Example:
<if> IBIF_persistentamp.upper EQ "YES"
<! _ibi_get_ampers=-TYPE <AMPERS>\n-? &&&&\n-TYPE </AMPERS> >
_ibi_get_ampers=\n
<else>

_ibi_get_ampers=\n
<endif>

This will comment out the line contained between <! and >. Then _ibi_get_ampers
is set to nothing whether IBIF_persistentamp is set to "YES" or "NO".

Before modifying the default.wfs file, please make a backup copy first. Then
after modifying the file and saving the changes, you will need to stop the
IIS Admin service and then start the World Wide Web Publishing service for the
changes to take effect.



My example page:




WebFOCUS Report


















PAGE 1

MODEL

COUNTRY

2000 4 DOOR BERLINA

ITALY




{!--
INSERT 0 1
HEADER_ID 17837
INSERT 0 1
CURRENTLY DEFINED & VARIABLES:
&&TSIBPATH = /opt/ibi/srv76/wfs/edatemp/ts000001/
&ACCEPTS = 0
&APPROOT = /opt/ibi/apps
&AUTOINDEX = NO
&BASEIO = 0
&CALLINGFEX = jnkaro24
&CHNGD = 0
&DATE = 12/01/08
.
.
.
&submit = Submit

WebFOCUS Version 7.6.2 compiled and linked on Tue Jun 26 21:27:18 EDT 2007 (Gen branch762:130)
--}


8.0.0.6, Ubuntu 12.04, All
 
Posts: 12 | Location: South Africa | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
RoyD,
The output will always be echoed in the html comment section. It is just the result of a command, and thus it will be included in the result set. I have not been able to find a way to not show the output.
I can only think of one way to do this, and that is to have it executed in the manner of how the html painter executes a fex to populate a drop-down box. The result of that process is never shown in the comments of the resulting html. Maybe you can do some research into that area?

BTW, Frances' tweak is not really needed. If you just specify a filename without a path in front of it, it will automatically be placed in the temporary directory.

Susannah/Waz: I'll think about submitting.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Expert
posted Hide Post
that's brilliant
thank you so much for such good research and posting back to all of us.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Member
posted Hide Post
Many thanks GamP. At this stage it probably isn't do-able, then. I might post it on TechSupport with IBI and see.

I don't use the Painters but I think they might be using an Ajax approach in which case any comments would be discarded (I tried it on some of my own stuff and that is what happened)

All the best
Roy


8.0.0.6, Ubuntu 12.04, All
 
Posts: 12 | Location: South Africa | Registered: February 07, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Write run-time &Variables to a file

Copyright © 1996-2020 Information Builders