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     [CLOSED] Array of & Variable Names?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Array of & Variable Names?
 Login/Join
 
Member
posted
-? & ;

Will list all of the current & variables and their values.

 
-* File DisplayVariable.fex
-DEFAULT &VariableName = 'TestVariable';
-DEFAULT &TestVariable = '123';

-SET &VariableName = '&' | &VariableName;
-SET &VariableType = &VariableName | '.TYPE';
-SET &VariableExists = &VariableName | '.EXISTS';
-SET &VariableLength = &VariableName | '.LENGTH';
-SET &VariableValue = &VariableName | '.EVAL';

-IF NOT (&VariableExists.EVAL) GOTO VariableDoesNotExist;
-TYPE Name: &VariableName Value: &VariableValue.EVAL  Type: &VariableType.EVAL Length: &VariableLength.EVAL
-GOTO Return
-VariableDoesNotExist
-TYPE Name: &VariableName Exists: &VariableExists.EVAL
-Return

 


So I would like to use this routine to list all the variables with their type and lengths. But how can I get an array of all the variable names?

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


7.7.03, Windows
HTML, Excel, PDF,
 
Posts: 13 | Registered: October 07, 2013Report This Post
Guru
posted Hide Post
1. Store output of -? & into hold file
2. Read hold file and store variable names in array

Used these two posts for following code.
[SOLVED] Write run-time &Variables to a file
Output data from report into Array

  
-SET &ECHO='OFF';

-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');
VAR1/A155 = GETTOK(RESULT,155,1,'=',155,VAR1);
VAR2/A155 = STRIP(155,VAR1,'&',VAR2);
END
TABLE FILE TRACE
PRINT VAR2
IF LINE CONTAINS 'ngput'
IF AMPER EQ '&'
ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
-SET &CNT = &LINES;


-* Store Variable Names in Array
-SET &I = 0;
-STRT_READ
-SET &I = &I + 1;
-READ H1 &VAR_ARR.&I.A155
-IF &I LT &CNT GOTO STRT_READ;

-? &VAR_ARR


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
 
Posts: 320 | Location: Memphis, TN | Registered: February 12, 2008Report This Post
Member
posted Hide Post
Thanks Mighty Max I will give it a try.


7.7.03, Windows
HTML, Excel, PDF,
 
Posts: 13 | Registered: October 07, 2013Report This Post
Expert
posted Hide Post
Fixed it for 7.7.x...
Use VAR2 if you only want the names; I like to use the Name and RESULT:
  
-SET &ECHO='OFF';
-SET &TEMPDIR   = TEMPPATH(100,'A100');
-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/A153 = SUBSTR(200,LINE,48,200,153,RESULT);
AMPER/A1    = EDIT(RESULT,'9');
VAR1/A153   = GETTOK(RESULT,153,1,'=',153,VAR1);
VAR2/A153   = STRIP(153,VAR1,'&',VAR2);
END
TABLE FILE TRACE
PRINT 
    RESULT 
WHERE LINE CONTAINS 'ngput';
WHERE RESULT CONTAINS '&'
  AND RESULT OMITS    '-?'
  AND RESULT OMITS    'CURRENTLY';
 ON TABLE HOLD AS H1 FORMAT ALPHA
END
-RUN
-SET &CNT = &LINES;
-* Store Variable Names in Array
-SET &I = 0;
-STRT_READ
-SET &I = &I + 1;
-SET &I = IF &I LT 10 THEN '0' || &I ELSE &I;
-READ H1 &VAR_ARR.&I.A153
-IF &I LT &CNT GOTO STRT_READ;

-? &VAR_ARR
-EXIT


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Member
posted Hide Post
This only will get variable names if they are 9 char or less. I am trying to get people out of the habit of using terrible variable names that are short but confusing. So this won't work for me. Obviously WF has the list stored in memory somewhere. Anyone know of another option that will work for variable names of any length?


7.7.03, Windows
HTML, Excel, PDF,
 
Posts: 13 | Registered: October 07, 2013Report This Post
Member
posted Hide Post
But thanks Tom and Max as it does work for capturing what is dumped to the output in a "array".


7.7.03, Windows
HTML, Excel, PDF,
 
Posts: 13 | Registered: October 07, 2013Report This Post
Virtuoso
posted Hide Post
Try using the following when "capturing" the list of variables to see if it helps:

-? & SAVEPRINT


It will give you not only each &variable's full name and value, but also how they got their values (via a -SET or -DEFAULT for instance).



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
Running this sample code in my environment:

-DEFAULT &WFFMT = 'EXL2K';
-DEFAULT &P_PROCESSING_DATE = &YYMD.EVAL;
-DEFAULT &P_FREQUENCY = 1;

-SET &&I_USER = LOCASE(&IBIMR_user.LENGTH, &IBIMR_user, 'A&IBIMR_user.LENGTH');
-SET &I_PROCESSING_FLAG = DECODE &P_FREQUENCY (1 'DAILY' 2 'WEEKLY' 3 'QUARTERLY' 4 'YEARLY' ELSE 'CUMULATIVE');

-? & SAVEPRINT


Provides the following:

 -*CURRENTLY DEFINED VARIABLES:
 -SET     &&I_USER = 'justme';
 -DEFAULT &ECHO = 'OFF ';
 -SET     &FOCEXURL = '/ibi_apps/WFServlet?IBIF_webapp=/ibi_apps&|IBIC_server=EDASERVE&|IBIWF_msgviewer=OFF&|';
 -SET     &FOCHTMLURL = '/ibi_html';
 -SET     &GOOGLEMAPSAPIKEY = ' ';
 -SET     &IBIMR_user = 'JustMe';
 -SET     &I_PROCESSING_FLAG = 'DAILY';
 -DEFAULT &P_FREQUENCY = 1;
 -DEFAULT &P_PROCESSING_DATE = 20131204;
 -SET     &WFDESCRIBE = OFF;
 -DEFAULT &WFFMT = 'EXL2K';


Both & and && variables are listed with a non-truncated name and specifying how each of them got its value (-SET / -DEFAULT).

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



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
New one on me!
Thanks! Works great...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
One of the coolest tricks presented by Rob Palmer at Summit. Loved it! Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
Thanks for sharing!!! Appreciate it!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
You're very welcome, Tom. Hopefully Steven will find this useful to solve his requirement.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Member
posted Hide Post
when I use -? & SAVEPRINT I get less variables than when I use -? &;

In one case I get 55 the other 22.

So I now can get the fullname I just dont' get all. Any ideas?


7.7.03, Windows
HTML, Excel, PDF,
 
Posts: 13 | Registered: October 07, 2013Report This Post
Virtuoso
posted Hide Post
Are you only interested in your application variables (the ones you control) or also internal ones such as &YYMD, &LINES, etc.?

I think SAVEPRINT excludes the latter from consideration so you'll have to pick which version (-? & vs. -? & SAVEPRINT) gives you the best bang for the buck given your reporting needs, or perhaps come up with your own technique to read both sets and merge the results somehow which is obviously not so straightforward due to truncated variables names.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report 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     [CLOSED] Array of & Variable Names?

Copyright © 1996-2020 Information Builders