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     Setting a parm from a file?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Setting a parm from a file?
 Login/Join
 
<MikeR>
posted
The following code:

-* File CARCO.FEX
TABLE FILE CAR
PRINT
COUNTRY
CAR
WHERE ( COUNTRY EQ
'&CNTRY.Please select country.'
);
END

accepts a country and then shows me a report.

I would like to read &CNTRY from columns 11 - 20 in a sequential file, and then run the report.

Is this possible?

Thank you.
 
Report This Post
Silver Member
posted Hide Post
You might try something like:

FI CFILE DISK E:\data\cntry.dat
-RUN
-READ CFILE &TRSH.A10. &CNTRY.A10.
-* File CARCO.FEX
TABLE FILE CAR
PRINT
COUNTRY
CAR
WHERE ( COUNTRY EQ
'&CNTRY'
);
END

hth,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<MikeR>
posted
If I run this:

-* File CARCO.FEX
FI CFILE DISK C:\ISMDR\COUNTRY.DAT
-RUN
-READ CFILE &TRSH.A10. &CNTRY.A10.
-*
TABLE FILE CAR
PRINT
COUNTRY
CAR
WHERE ( COUNTRY EQ '&CNTRY' );
END

I get this error:

0 ERROR AT OR NEAR LINE 9 IN PROCEDURE MEMFEX FOCEXEC *
(FOC295) A VALUE IS MISSING FOR: CNTRY

Is there some way to see if I am getting the correct data in &CNTRY?
 
Report This Post
Guru
posted Hide Post
Try FILEDEF instead of FI CFILE.
 
Posts: 406 | Location: Canada | Registered: May 31, 2004Report This Post
<MikeR>
posted
FILEDEF gives me the same error
 
Report This Post
Virtuoso
posted Hide Post
Regarding the wanting to get the variable from a file. Is the only record in the file the value you want? If so if you filedef the file and then do a selection

filedef cntry .....
Table file car
if country eq (cntry)
....

This is the method I use to find a set of items usually student records in my case, but you would get all of the 'car' entries in the cntry file so if you had japan and england in the file you would get all cars in japan and england.

Of course I may be completely missinterpreting what you want to do here.

Leah C.
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Silver Member
posted Hide Post
to see the values of the -READ, put :

-TYPE trash = &TRSH country = &CNTRY
-EXIT

directly after the -READ

this will display the values and cause the focexec to end before producing any output, this will let you see the results of the -TYPE statement.

hth,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<MikeR>
posted
First, I would like to thank both Drew and Leah for their suggestions and answer both of them at the same time.

Leah, I do only have 1 record with the country in it, but it's not in the first 10 positions of the record. The real file (I am using the CAR file just to see if I can get this to work) is a sequential file on the mainframe with the search criteria in positions 21 - 29.

Drew, if I run this:

-* File CARCO.FEX
FILEDEF CFILE DISK C:\ISMDR\COUNTRY.TXT
-RUN
-READ CFILE &TRSH.A10.,&CNTRY.A10.
-TYPE trash = &TRSH country = &CNTRY
END

I get a message:

(FOC295) A VALUE IS MISSING FOR: TRSH

which would seem to indicate that there is something wrong with my file definition. I do have a sequential file defined on the mainframe which I eventually want to read if that would simplify things.

Mike R
 
Report This Post
Silver Member
posted Hide Post
Please remove the comma (,) from your read statement.

Is the file C:\ISMDR\COUNTRY.TXT on the (windows) reporting server? or are you doing this from developer? If your webfocus is on the mainframe; then we need to define the file in a different way to webfocus.

I created a file on my (windows) reporting server with the contents :

1234567890abcdefghij###########

and then I ran this program:

FILEDEF CFILE DISK C:\ibi\apps\TESTDATA.TXT
-RUN

-READ CFILE &TRSH.A10. &CNTRY.A10.

-TYPE trash = &TRSH country = &CNTRY
-EXIT

and I got this result:


No HTML Output!

--------------------------------------------------------------------------------


trash = 1234567890 country = abcdefghij


What mainframe environment are you in? Perhaps it would be easier to work on the solution there.

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<MikeR>
posted
Interesting.... This code:
FI CFILE DISK C:\ISMDR\COUNTRY.DAT
-RUN
-READ CFILE &TRSH.A10. &CNTRY.A10.
-TYPE trash = &TRSH
shows:
trash = 1234567890

This code:
FI CFILE DISK C:\ISMDR\COUNTRY.DAT
-RUN
-READ CFILE &TRSH.A10. &CNTRY.A10.
-TYPE country = &CNTRY
shows:
(FOC295) A VALUE IS MISSING FOR: CNTRY

which seems to indicate that I can read the file which is defined on the C: drive of the Test Server, but can't read 2 fields. I changed the type of the file from TXT to DAT to see if that made a difference, but eventually I would like to read a mainframe file that is defined to WebFocus if it's cleaner to skip the distributed file altogether.
 
Report This Post
Silver Member
posted Hide Post
that looks very much like you are trying to read more bytes than the file contains.

try adding more bytes than you need to the file or changing the -READ to read fewer bytes from the file (i.e. -READ CFILE &TRSH.A10 &CNTRY.A5. )

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<MikeR>
posted
Drew,

Amazingly simple once you know the answer. Since I have FRANCE in my country field, I changed the second definition from A10 to A6 and it runs like a champ. Thank you very much.

Now, can I point this to a mainframe file? (I don't want to get greedy here - you've gotten me a long way down the road).

Thanks again.

Mike R
 
Report This Post
Silver Member
posted Hide Post
Mike,

You need to have the file you are going to read available to the reporting server. Do you have the reporting server running on your mainframe where the file is? or what is your setup?

regards,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report This Post
<MikeR>
posted
Drew,

The reporting server is running on a Windows box, but it does have access to mainframe files. For example:

TABLE FILE SEQT3
PRINT
CNTRY
END

will print FRANCE from the sequential file.

Mike R
 
Report This Post
Silver Member
posted Hide Post
Then there are a few ways you could go; like using join with ALL=OFF or match file to select only the inner join data (OLD AND NEW). But I would think a simple approach might be:

TABLE FILE SEQT3
PRINT
CNTRY
ON TABLE SAVE
END
-RUN
-IF &LINES EQ 0 GOTO ... ;
TABLE FILE ...
PRINT ...
WHERE COUNTRY IN FILE SAVE
...

Please make sure that the format for the field from the first (mainframe) file CNTRY is identical to the format of COUNTRY; if not, change it to be so with a define.

This would also allow for multiple CNTRY values. (within the FOCUS limits for files to be used with WHERE)

hth,

drew
 
Posts: 46 | Location: San Francisco, California | Registered: April 14, 2003Report 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     Setting a parm from a file?

Copyright © 1996-2020 Information Builders