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] How to get around calling to a step outside an -INCLUDE

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to get around calling to a step outside an -INCLUDE
 Login/Join
 
Guru
posted
In Mainframe FOCUS, the manual says you can't call to a location in a FOCEXEC that is outside an -INCLUDE. I want to include an -INCLUDE that might have several -GOTO statements.

Has anyone been able to circumvent this limitation, and if you did, how did you do it?

Thanks to all who reply.... this forum is great!

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


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
Have you tried what you are wanting to do and getting an error? I'm not exactly sure what it is you're trying to accomplish but from your brief description, I don't think there would be a problem. You need to take care that you don't create duplicate labels when you -INCLUDE code that also has labels, loops, or -GOTOs. I've found multiple examples over time of things the book says you can't do, but they work (and a few things it says work that don't !!) Best bet it to try it out first. If you have problems or error messages after that, then explore other possibilities.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
The inner fex may have -GOTO statements; the restriction is that their target (where they 'go to') must be a label declared in the inner fex itself.

You should avoid duplicate labels (identical label appearing in the inner and outer fexes) -- best practice is to include a prefix unique to the fex as part of any label. You can use '.' to separate the prefix from the 'meaningful' part of the label, along these lines:

-REPEAT FOO.LOOP1 FOR &I FROM &A TO &B ;
. . .
-IF (...) THEN GOTO FOO.EXIT1;
. . .
-FOO.LOOP1
-FOO.EXIT1

If the inner fex needs to cause branching in the outer, it should set a dialog manager variable for the outer fex to test.


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
Thanks for your fast replies! There are no duplicate labels in the FEX I'm trying to include...what I'm trying to do is to have my logic go to somewhere else in the primary FEX. So... there's no way around trying to goto an outside area from an include?

Here's my code - it keeps bombing on the GOTO MAINSTEP.

-IF   &INSTX   EQ 'SAC'  GOTO SETFORSPC; 
-IF   &INSTX   EQ 'SPC'  GOTO SETFORPAC; 
-IF   &INSTX   EQ 'PAC'  GOTO SETFORNVC; 
-IF   &INSTX   EQ 'NVC'  GOTO SETFORNLC; 
-IF   &INSTX   EQ 'NLC'  GOTO TABLTHIS;  
-SETFORSPC                               
-SET &INSTX = 'SPC';                     
-SET &COL   = 2;                         
-GOTO MAINSTEP                           
-SETFORPAC                               
-SET &INSTX = 'PAC';                     
-SET &COL   = 3;                         
-GOTO MAINSTEP                           
-SETFORNVC                               
-SET &INSTX = 'NVC';                     
-SET &COL   = 4;                         
-GOTO MAINSTEP                           
-SETFORNLC                               
-SET &INSTX = 'NLC';                     
-SET &COL   = 5;                         
  


Thanks again.....


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
If that absolutely does not work, you could easily rearrange your code and by controlling where you place the -INCLUDE, you could make this work. For example, put -MAINSTEP at the end of your inner fex and then -INCLUDE this fex in place of the -MAINSTEP line in your outer fex. You may want to test for the 'NLC' values also in you outer fex. Again, be aware that if your -GOTOs are such that this code may be -INCLUDED more than once (which it appears to me may be the case) you've got duplicate labels.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
If your INCLUDEd fex is just before the MAINSTEP label of the main program, you could make the GOTO label the last line of code in the INCLUDE, then the main program would just continue to the MAINSTEP label:

-IF   &INSTX   EQ 'SAC'  GOTO SETFORSPC; 
-IF   &INSTX   EQ 'SPC'  GOTO SETFORPAC; 
-IF   &INSTX   EQ 'PAC'  GOTO SETFORNVC; 
-IF   &INSTX   EQ 'NVC'  GOTO SETFORNLC; 
-IF   &INSTX   EQ 'NLC'  GOTO TABLTHIS;  

-SETFORSPC                               
-SET &INSTX = 'SPC';                     
-SET &COL   = 2;                         
-GOTO PREMAINSTEP

-SETFORPAC                               
-SET &INSTX = 'PAC';                     
-SET &COL   = 3;                         
-GOTO PREMAINSTEP

-SETFORNVC                               
-SET &INSTX = 'NVC';                     
-SET &COL   = 4;                         
-GOTO PREMAINSTEP

-SETFORNLC                               
-SET &INSTX = 'NLC';                     
-SET &COL   = 5;      

-TABLTHIS

-PREMAINSTEP 

Though this scenario is probably unlikely in your case.


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
Guru
posted Hide Post
And thank you all for offering thoughts and assistance. Unfortunately, the -INCLUDEd part is at the end of a loop, not at the start.... in other words, in my main program, I've got something similar to the following pseudocode:

Start the FEX
After some calculations get into the main processing
-MAINSTEP
.....
.....
.....
Body of processing goes here.....
....
....
my INCLUDE goes here (the one that says GOTO MAINSTEP)
....
....

So as you can see, your suggestions, while valid in your suggestions, will not work here. If you have any other suggestions, I'm all ears (or is it eyes?). Thanks!


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Gold member
posted Hide Post
What you could do is set a variable in your include that tell the Focexec to go to MAINSTEP. The have the actual GOTO be to the last line in the INCLUDE. The first line after the INCLUDE would query that variable to determine whether it should GOTO MAINSTEP, or just continue processing. Something like:
Start the FEX
After some calculations get into the main processing
-MAINSTEP
.....
.....
.....
Body of processing goes here.....
....
....
my INCLUDE goes here (the one that sets &MYGOTO = 'Y' (a variable) and says GOTO LASTLINE)
-IF &MYVAR = 'Y' THEN GOTO MAINSTEP;
....
....


Diptesh
WF 7.1.7 - AIX, MVS
 
Posts: 79 | Location: Warren, NJ, USA | Registered: October 25, 2006Report This Post
Virtuoso
posted Hide Post
Is there a reason that this has to be -INCLUDEd? Just put the code where you need instead of -INCLUDEing it. In any case, as mentioned before since you've got the -INCLUDE inside a loop (created with your -GOTOs) you're -INCLUDING your inner code multiple times and DUPLICATING LABELS. It is not going to work that way - you've got to come up with an alternate processing flow.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
You can -INCLUDE the same fex in several places (or within a loop); when a GOTO is encountered, control will continue at the line with that label in the 'currently active instance' of the inner fex, within the context of the outer fex (or the nest of outer fexes).

Focus (or WF) keeps track of the location (fex, line) of labels it encounters. If the taget label of a GOTO is already known, control skips directly there; if not, Focus scans through the current fex for the label. -- But if an inner fex has -GOTO xxx, where xxx was previously encountered as a label in a different fex file, you get an error.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Guru
posted Hide Post
Diptesh,

Thank you for your suggestion.... I'm going to try working with it and see what happens.

Darin,

The reason for trying to use an -INCLUDE is twofold.... to cut down on the keyboard work I have to do per program and to have just one piece of code as an INCLUDE so that I don't have to change a whole bunch of programs if one thing changes down the road.

Jack,

It sounds like you were answering Darin's reply...is that correct?

Thanks to all!!


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Virtuoso
posted Hide Post
WebMeister,

The following may also be helpful:
In the outer fex there are a number of labels that could be jumped to.
The condition that controls which label to go to is inside the include fex.
What you could do is to set an &-variable (say &NEXT_STEP) in the outer fex that holds the name of the default label to go to. This variable could then be changed in the include fex to the name of whatever label it needs. After returning from your include fex, you simply say -GOTO &NEXT_STEP.

Hope this helps ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
GamP,

But wouldn't that end up still being the same thing? In other words, if the inside FOCEXEC can't actually do a _GOTO to an outside FOCEXEC label, how would the inside FOCEXEC go to an &-variable which is outside of the inside FOCEXEC?

Or am I getting myself confused?

In any case, thanks for replying....I appreciate it!


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report This Post
Expert
posted Hide Post
What I think GamP means is that in your inner INCLUDE you would set a DM variable with the name of the label (which is in your outer fex) you would like to GOTO, then, also in your inner INCLUDE you would go to the end of that fex. Back in the outer fex, just after the INCLUDE statement, you would have a -GOTO &NEXT_STEP.

Something like this:

-*Start the FEX
-*After some calculations get into the main processing

-MAINSTEP

.....
.....
.....

Body of processing goes here.....

....
....

-INCLUDE SETFOR

-IF   &INSTX   EQ 'SAC'  GOTO SETFORSPC;
-IF   &INSTX   EQ 'SPC'  GOTO SETFORPAC;
-IF   &INSTX   EQ 'PAC'  GOTO SETFORNVC;
-IF   &INSTX   EQ 'NVC'  GOTO SETFORNLC;
-IF   &INSTX   EQ 'NLC'  GOTO TABLTHIS;

-SETFORSPC
-SET &INSTX = 'SPC';
-SET &COL   = 2;
-SET &NEXT_STEP = 'MAINSTEP';
-GOTO PREMAINSTEP

-SETFORPAC
-SET &INSTX = 'PAC';
-SET &COL   = 3;
-SET &NEXT_STEP = 'MAINSTEP';
-GOTO PREMAINSTEP

-SETFORNVC
-SET &INSTX = 'NVC';
-SET &COL   = 4;
-SET &NEXT_STEP = 'MAINSTEP';
-GOTO PREMAINSTEP

-SETFORNLC
-SET &INSTX = 'NLC';
-SET &COL   = 5;
-SET &NEXT_STEP = 'MAINSTEP';
-GOTO PREMAINSTEP

-TABLTHIS
-SET &NEXT_STEP = 'ELSEWHERE';

-PREMAINSTEP

-GOTO &NEXT_STEP

-ELSEWHERE

....
....


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
Guru
posted Hide Post
Francis,

I think I am beginning to see the light at the end of the tunnel....thnak you for your clarifications.

It sure would be nice if IBI ever allows a -GOTO in an inner fex to call to a label in an outer fex, wouldn't it?

Thanks for your advice - I appreciate your taking the time to write.


Mainframe FOCUS 7.0
VM/CMS and MVS/TSO
 
Posts: 250 | Registered: January 14, 2008Report 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] How to get around calling to a step outside an -INCLUDE

Copyright © 1996-2020 Information Builders