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     Looping a report with a parameter - (Mainframe Focus)

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Looping a report with a parameter - (Mainframe Focus)
 Login/Join
 
Member
posted
Hi there,

I wonder if anyone could possibly help me.
Smiler

I need to perform a FOR...NEXT loop in Focus.

I have a report that produces several outputs but only has one criteria. (Currency code).

I require this report run several times. Once for each currency code in my list.

Previously I have amended the criteria manually each time and submitted the report several times. (Once for each currency.)

More recently I have setup several copies of the main report, each one containing a seperate currency code. This way I am able to submit all of these reports overnight without a problem, but still it isn't ideal - especially if I need to make any changes to the report(s).

So, here is my question:

Is there a way I can set an array for the currency codes and get the report to loop for each currency?

Is this possible within focus?

The closest I have come to this is using a seperate focus report that sets a parameter and then uses INCLUDE to call the main focus report. This works, but it means I have to have 2 seperate reports and it still requires a section for each parameter and call.

Here is the calling focus report:

-SET &CUR = '40';
-INCLUDE CCYREPORT
-RUN
-SET &CUR = '41';
-INCLUDE CCYREPORT
-RUN

etc...

The CCYREPORT then uses the &CUR criteria and applies it the the relevant field.

Many thanks,
Jamie Cool


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Expert
posted Hide Post
easy
Lets assume the number of currencies is known and fixed...
lets say its 3
-SET &KOUNTER = 0 ;
-REPEAT end.loop 3 TIMES
-SET &KOUNTER = &KOUNTER + 1 ;
-SET &CUR=DECODE &KOUNTER( 1 'EU' 2 'GBP' 3 'USD');
... insert the body of your fex here, using the parameter &CUR however you need to use it.
-RUN
-end.loop
-eoj.thisfex
Jamie, note that the way you have it currently, with double includes, if there are statement labels with goto's in that fex, you'll have branching problems.

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




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
Thankyou so much Susannah!
That worked a treat! Big Grin

Just a few quick questions if I may, just so I fully understand it. (My Focus knowledge is very basic)...

Is &KOUNTER a keyword within Focus or is it just the name given in this instance?

Is there a limit on how many items I can use in a decode? Also, if the decode is longer than one line at which point do I perform a split without causing a problem?

One last question. What does the line -eoj.thisfex do? I replaced thisfex with the name of my focus job (fex!?) and it worked fine. Is EOJ - End Of Job?

Once again, many thanks for your time.
You have saved me hours!

Jamie


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Expert
posted Hide Post
just a name given in this instance
i use I, J, K for all things integer...being a math head.
-eoj.thisfex is just a statement label.
eoj is end of job, yep.
All my statement labels are lower case, for easy readability.
Sure decodes can wrap; just make sure to start each new line with a -
(because this decode exists in Dialog Manager you need the dashes)
There is a limit to a decode but i can't remember what it is.. 40, 50, some char size? dunno.
-SET &CUR = DECODE &KOUNTER ( 1 'GBP'
- 2 'EU' 3 'USD'
- 4 'INDONESIAN RUPIA' );

You could, if you wanted, not use the -REPEAT syntax and handle all the looping yourself.
-SET &KOUNTER = 0 ;
-top.loop
-SET &KOUNTER = &KOUNTER + 1 ;
-IF &KOUNTER GT &SOMEVALUE GOTO eoj.thisfex ;
-SET &CUR = DECODE...etc
...fex bits...yes fex is focexec, its the suffix on the actual program file
-RUN
-IF &KOUNTER LT &SOMEVALUE GOTO top.loop ;
or
-IF &KOUNTER EQ &SOMEVALUE GOTO eoj.thisfex ;

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




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
Hi Jamie,

FYI - Here's an example of using an external file to drive a loop. I created the external file from the CAR table just for this example. You could filedef any file that you would want to use.

TABLE FILE CAR
SUM SEATS
BY COUNTRY
ON TABLE SAVE AS H_CAR
END
-RUN
-*
-***
-*
-SET &CNT = 0;
-SET &V_COU = ' ';
-SET &V_SEA = ' ';
-*
-TYPE START LOOP
-TYPE ----------------------------------------------------------------
-LOOPER
-READ H_CAR &V_COU.A10. &V_SEA.I3.
-IF &IORETURN NE 0 GOTO EOF;
-*
-SET &CNT = &CNT + 1;
-TYPE IORETURN=&IORETURN --- CNT=&CNT --- V_COU=&V_COU --- V_SEA=&V_SEA
-*
-* INCLUDE YOUR FEX HERE WITH A -RUN COMMAND
-*
-GOTO LOOPER
-EOF
-TYPE ----------------------------------------------------------------
-TYPE END LOOP --- IORETURN = &IORETURN

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Member
posted Hide Post
Thank you very much for answering my questions and for your help. Wink

The information you have provided is very helpful.

Big Grin

Jamie


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Guru
posted Hide Post
Then again... if the report is the same for each iteration why not simply sort on the cuurency code as the primary sort field using page breaks and the repaging option which starts the page numbering again.

This way you pass through the data only once and all of your reports get created at the same time. They can then be split apart based on the currency code.


ttfn, kp


Access to most releases from R52x, on multiple platforms.
 
Posts: 346 | Location: Melbourne Australia | Registered: April 15, 2003Report This Post
Expert
posted Hide Post
Jamie,

You don't say what MF you are using but whether you are using Z/OS or Z/VM you could just EX the fex in your bacth job (JCL or REXX/EXEC) for each currency code you want rather than use a loop?

EX CCYREPORT CUR='40'
EX CCYREPORT CUR='41'
.......

The reason I would keep the main fex seperate and use it in this way is that as sure as eggs are eggs, at least one of your users will require a rerun of one particular currency and if you box it up with a looping process, you then have to problem of singling out one currency code to achieve that (unless you use Jims external file method).

Using it as a single fex with one parameter input allows you greater flexibility (imho).

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Thanks - I'll give those a try. Calling a fex and passing a parameter will be very helpful to me. Big Grin

How do I find out whether I'm using Z/OS or Z/VM?

I'm running a mainframe session of Focus on a WindowsXP machine. (Not WebFocus)

Logs from my fex quote FOCUS 7.1.1.
Does this help? (I'd like to be able to put information on my posts so people know exactly what I'm using...)

Many thanks for your help.


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Expert
posted Hide Post
Hi Jamie,

When you say you are running a mainframe session via an XP machine, I take it that you are using something like PC3270 to access it?

If this is the case then how are you using FOCUS?

Are you in the IT team there or are you and End User? If an End User then give your IT people a call and they should assist you. Alternatively update your profile with your company name and I may be able to tell you what you have (from experience).

Altenatively, call 0845 658 8181 (IB Support desk in the UK) and have a chat with the support person (Frank).

Good luck

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hi Tony,

I am using Personal Communication v5.6 to login to TSO and access Focus. (The screen is black and text is green.) I am now sure how I can find anything further. Is there a way I can run a fex to tell me more?

Maybe a VERSION command?

I am in the IT / Management Reporting team.

Thanks,
Jamie


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Expert
posted Hide Post
Hi Jamie,

You are most likely on Z/OS if you are using TSO.

You will be running your fexes via a JCL deck using the SYSIN DD to include your fexes execution -

SYSIN DD *
EX CCYREPORT CUR='40'
EX CCYREPORT CUR='41'

Ring any bells?

I would still suggest, for a full and detailed platform list, giving your IT people a call or IB support desk.

BTW - Bank or Grocery?

Regards

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Hi Tony,

Thanks for the help but I'm still rather confused about the version or Focus I'm using. I think I'll have to liasie with the system support people here. The SYSIN DD * part doesn't ring any bells, and neither does the Bank / Grocery part unfortunately. But if I had to make a choice, I'd go with Bank.(!?)

Thanks,
Jamie


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Expert
posted Hide Post
Hi Jamie,

Your version is 7.1.1 (from your previous post) and is always shown in the syslog.

On the Bank / Grocery front, I was meaning your Co's business. Where are you based ?

Regards

Tony



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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
Tony,

Our business is Insurance and I am based in the UK.

Thanks,
Jamie


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Virtuoso
posted Hide Post
Can you type in the following and run it in a focus program?

? GEN

Works for the Web version, not sure of mainframe version.


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Member
posted Hide Post
Hi,

Thanks, but it didn't work unfortunately.
It said "UNRECOGNISED QUERY" in the log.

However, I did see //SYSIN DD in the job. It appears this is added when submitted. In fact, a whole host of things are added, as below:


//UKJ2TTES JOB UKJ2T,'TESTER UK',NOTIFY=UKJ2T,
// CLASS=r,MSGCLASS=Z,MSGLEVEL=(1,1)
//FOC EXEC HJFOC,PRTCL=W,U=UKJ2T,F=UK,FI=TSP,SWCARSTD=N,
// SYSOUT=4,UCS=STDL,DU=UKJ2T,DEST=UU06,HOLD=YES,K7=N,
// FIUSER=Y,FIUSERID=UKJ2T
//SYSIN DD *
./ ADD NAME=TESTER
? GEN
//*
//FOC.SYSIN DD *
EX TESTER
FIN
//*


Z/OS - MF FOCUS 7.1.1
 
Posts: 13 | Location: UK | Registered: February 15, 2006Report This Post
Platinum Member
posted Hide Post
? release

gives the mainframe version of Focus.

? ptf will give all the applied patches.

et


FOCUS 7.6 MVS PDF,HTML,EXCEL
 
Posts: 115 | Location: Chicago, IL | Registered: May 28, 2004Report 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     Looping a report with a parameter - (Mainframe Focus)

Copyright © 1996-2020 Information Builders