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] Selecting fields for Saving

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Selecting fields for Saving
 Login/Join
 
Silver Member
posted
Hi guys, I got a question and hope you can help me.
I need to retrieve a field, for example:
TABLE FILE MFQFIL1
 PRINT FIELD_A                      
 WHERE (FIELD_B = 'X')
END


I need to get FIELD_A in order to be saved in another file.
TABLEF FILE FILE001                                                                 
   PRINT COMPUTE ABC_FILE001/A15  = FIELD_A;                                                                      
ON TABLE SAVE AS FILE002  


For now, I can't run the code so would you tell me if this statement is correct?

Thank you.

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


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Virtuoso
posted Hide Post
you need a ON TABLE HOLD AS FILE001 FORMAT FOCUS
on the first fex.
Doesn't have to be FORMAT FOCUS...but you get the idea.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
And don't forget the END after ON TABLE SAVE.

Do you need to reread FILE002, if so change SAVE to HOLD or HOLD FORMAT ALPHA, etc.


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
Silver Member
posted Hide Post
Hi guys, I tried to do what you indicated

I have this block of code
MATCH FILE FILE001
PRINT PRT
BY    LICTA  NOPRINT
RUN
FILE FILE002
PRINT NTA
BY    LICTA  NOPRINT
AFTER MATCH HOLD AS FLHOLDBD OLD
END


Here Im trying to use the field PRT of FILE001:
DEFINE FILE ANTFILE
  TAGFR/A22  = PRT;
END


But I'm getting this error:
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: PRT
 


Do you know what the problem is?

Thank you


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Virtuoso
posted Hide Post
Where is ANTFILE?

Do a TABLE FILE FLDHOLDBD
PRINT *
END

and see if PRT is there.
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Silver Member
posted Hide Post
Hi Prarie thank you for your response, I don't have a FOCUS Console where I can do table FILE, I'm running my FOCUS program under Z/OS. Is there another way to find the error?

Thank you


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Master
posted Hide Post
Basically your MATCH FILE logic looks OK. But I'm confused as to where the DEFINE fits too.

Also, It might be useful if you tried to reduce the number of variables in order to isolate the problem. I would change the name of your PRT field - it's possibly part of some reserved word - maybe undocumented, to something like PRTABCD.

Then, I don't see why you have the NOPRINT for the field LICTA. You will be doing a subsequent TABLE request against your hold file so having an additional column in it does no harm. Finally I would change your AFTER MATCH statement to say HOLD AS FLHOLDBD OLD-AND-NEW and then do as Prarie suggests to see if the newly-named 'PRTABCD' field shows up. I know that's not the final result you want, but it will indicate if PRTABCD occurs in any records that overlap with LICTA.

In addition you can SET &ECHO=ALL ahead of your MATCH FILE and the subsequent TABLE request and it should show how many records were selected at each stage of the MATCH FILE process.

PS - What do you mean you can't do a TABLE FILE request? Just slot Prarie's code right in after the MATCH FILE sequence.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Silver Member
posted Hide Post
George, thank you for your considerations. I think I misunderstood what I Prarie indicated. My main problem is reuse the field PRT in my FILE ANTFILE.

I forgot to mention that FILE001 and ANTFILE have a common field, so what I did was a JOIN between this two files and now I can use the field PRT.

Was my solution correct?


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Master
posted Hide Post
The JOIN is more efficient as long as the TO file has a common field that is INDEXED. The MATCH FILE logic is invaluable where the common fields are not indexed. Because MATCH FILE requires each original data source to be sorted by the same field it means the relevant records from each data set can be matched up. Note that when using MATCH FILE you can insert a WHERE clause for each data set processed just as you would with a TABLE request in order to limit the number of records selected.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Report This Post
Expert
posted Hide Post
It may be a good isea to post the whole sequence of code.


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
Silver Member
posted Hide Post
The sequence of code I used was:

MATCH FILE FILE001
PRINT PRT
BY    LICTA  NOPRINT
RUN
FILE FILE002
PRINT NTA
      ADDFIELD
BY    LICTA  NOPRINT
AFTER MATCH HOLD AS FLHOLDBD OLD
END

JOIN ADDFIELD IN FLHOLDBD TO
     ADDFIELD2 IN ANTFILE  AS J6


Now I could reuse the PRT field of FLHOLDBD.

 
DEFINE FILE ANTFILE
  TAGFR/A22  = PRT;
END


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Expert
posted Hide Post
Your define is on ANTFILE, but your join is from FLHOLDBD to ANTFILE.

What is the common field in the two files.

Seems to me that your DEFINE should be:
DEFINE FILE FLHOLDBD
  PRT/A22  = TAGFR;
END


Assuming that TAGFR is the field in ANTFILE.


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
Silver Member
posted Hide Post
Yes, I made a mistake my join has to be from ANTFILE to FLHOLDBD.
The common field between the two fields would be ADDFIELD (FLHOLDBD) and ADDFIELD2(ANTFILE)


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Silver Member
posted Hide Post
Although I could sort out the problem I got a question. What if ANTFILE and FLHOLDBD didn't have a common field, how do I use the field PRT?
Can I declare global variables in FOCUS as in other languages?


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Expert
posted Hide Post
If you mean temporary fields, then yes.

DEFINE or COMPUTE, depending on where you want to create the field.


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
Silver Member
posted Hide Post
I want to store PRT in a temporary variable, so it can be used in other part of my code.
Just one question, this temporary variable has to be declared with an ampersand? I ask that because on my program I've seen some variables which start with & but they all come from the JCL that executes the program.


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Virtuoso
posted Hide Post
if you want to store it in a temporary field you should to this

suppose the field PRT is A8 lenght

SET HOLDLIST=PRINTONLY 
TABLE FILE XXX
PRINT PRT
ON TABLE HOLD FORMAT ALPHA
END
-RUN
-READ HOLD &TEMPVAR1.A8

-TYPE &TEMPVAR1

TABLE FILE CAR
PRINT MODEL
BY COUNTRY
HEADING 
"this is the tempfield &TEMPVAR "
END




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
Silver Member
posted Hide Post
Thank you Frank, but what if I wanted to store more variable not just one for example:
TABLE FILE XXX
PRINT PRT
      COR
      CRD
ON TABLE HOLD FORMAT ALPHA
END

How do I store the values of PRT,CORD and CRD in 3 different variables?
Or what if I just wanted to store CRD variable and not the others?

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


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Virtuoso
posted Hide Post
A quick look at the manuals in Dev. Studio for -READ shows:

-READ filename[,] [NOCLOSE] &name[.format.][,][&name][.format.]


So, all you need to do is:

-READ HOLD &PRT.A8. &COR.A8. &CRD.&A8.


As only you know what COR and CRD means and what their sizes are I am using A8 as an example but you'll have to adjust accordingly.

More detailed information with samples and all can be found in the Developing Reporting Applications manual under:

Managing flow of Control in an Application > Customizing a Procedure with Variables > Reading Variable Values From and Writing Variable Values to an External File

That, and other guides are available with your local installation of Developer Studio or can be accessed/downloaded from IBI's tech support site.

Hope that helps.



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
Silver Member
posted Hide Post
Thank you but If only want to store the last variable and not the others what do I change?


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Virtuoso
posted Hide Post
You can't pick and choose at that level of detail.

If you TABLE FILE PRINT 3 columns, then the resulting ALPHA file will contain a string of values with those 3 fields.

If you only need to extract field 2 fron the text file under a certain condition you can:

-READ HOLD &DUMMY1.A8. &CRD.A8. &DUMMY2.A8


and then just do nothing with &DUMMY1 and &DUMMY2. They are just variables so you don't have to use them.

That, of you can get fancy and make your TABLE FILE PRINT statement more "dynamic" via Dialogue Manager to add only the fields you need, but then you'll have to have various versions of -READ (with 1, 2 and all variables) and -GOTO to each depending on your needs. Too unnecessarily complicated in my opinion.

If you were using WF 7.7 you could take advantage of the new -READFILE command but it is unfortunately not available in 7.6.

Just go with the &DUMM1n approach and you should be fine.



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
Silver Member
posted Hide Post
Thank you I understood, going to try your idea.
However I believed that I could reuse a field of a HOLD FILE without declaring extra temporary variables.


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report This Post
Silver Member
posted Hide Post
Thank you all of you guys, I tried the solution of njsden and could resolve my problem.

The discussion can be marked as SOLVED.


WebFOCUS 7.1.4
Windows, All Outputs
 
Posts: 35 | Registered: December 21, 2011Report 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] Selecting fields for Saving

Copyright © 1996-2020 Information Builders