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] Trying to print a flat file of text

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Trying to print a flat file of text
 Login/Join
 
Platinum Member
posted
After an hour or so of banging my head against the 'wall of FOCUS' and reading Chapter 5 of the "Describing Data ..." manual, I've given up and am asking for your help in making this simple bit of code work the way it looks like it should work!

I want list the content of a *.txt file; an application control table containing variable length text strings up to 25 characters long. (If this works, I'll expand it with parameters into a generic control file viewer.)

Here's the code of my test example:
 
-* Put temporary text file into the 'NA' applib
APP PREPENDPATH NA
APP HOLDDATA NA
APP HOLDMETA NA
-RUN
-* Generate a temporary *.mas for the text file
FILEDEF MAS DISK E:\ibi\apps\NA\TEMPTEXT.mas
-RUN
-WRITE MAS FILENAME=TEMPTEXT, SUFFIX=FIX, $
-WRITE MAS SEGNAME=SEG1, $
-WRITE MAS FIELDNAME=HEADER_TEXT, FORMAT=A25V, ACTUAL=A25V , $
-RUN
-* Generate content into the temporary text file
FILEDEF DAT DISK E:\ibi\apps\NA\TEMPTEXT.ftm
-RUN
-WRITE DAT 123456 
-WRITE DAT com-bbb-cccc
-WRITE DAT The quick brown fox ...
-RUN
-* Display the content of the temporary text file
TABLE FILE TEMPTEXT
PRINT
     HEADER_TEXT
ON TABLE PCHOLD FORMAT HTML
END
-RUN
 


What I get as a result is (with message viewer OFF):
 
0 NUMBER OF RECORDS IN TABLE=        0  LINES=      0
 

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


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
 
Posts: 154 | Location: NY | Registered: October 27, 2005Report This Post
Expert
posted Hide Post
Chris,

You're going to kill yourself. The ddname for your filedef for the file needs to be the same as the name that you are tableing or you need to re-filedef it.

FILEDEF TEMPTXT DISK NA\temptext.ftm
-RUN
-WRITE TEMPTEXT 123456 
-WRITE TEMPTEXT com-bbb-cccc
-WRITE TEMPTEXT The quick brown fox ...

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


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
 
Posts: 2723 | Location: Ann Arbor, MI | Registered: April 05, 2006Report This Post
Virtuoso
posted Hide Post
Sometime one needs another eye. Wink


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Expert
posted Hide Post
Ginny is right the master file name must be the same as the data files ddname.

Also I don't think the ACTUAL=A25V is right, you probably only want A25 for ACTUAL and USAGE
-* Put temporary text file into the 'NA' applib
APP PREPENDPATH NA
APP HOLDDATA NA
APP HOLDMETA NA
-RUN
-* Generate a temporary *.mas for the text file
FILEDEF MAS DISK E:\ibi\apps\NA\TEMPTEXT.mas
-RUN
-WRITE MAS FILENAME=TEMPTEXT, SUFFIX=FIX, $
-WRITE MAS SEGNAME=SEG1, $
-WRITE MAS FIELDNAME=HEADER_TEXT, FORMAT=A25, ACTUAL=A25 , $
-RUN
-* Generate content into the temporary text file
FILEDEF TEMPTEXT DISK E:\ibi\apps\NA\TEMPTEXT.ftm
-RUN
-WRITE TEMPTEXT 123456 
-WRITE TEMPTEXT com-bbb-cccc
-WRITE TEMPTEXT The quick brown fox ...
-RUN
-* Display the content of the temporary text file
TABLE FILE TEMPTEXT
PRINT
     HEADER_TEXT
ON TABLE PCHOLD FORMAT HTML
END
-RUN


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
Expert
posted Hide Post
Chris, time for a nap!
we've all been there. Wink




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
Master
posted Hide Post
CBURTT,

Is there just one field in each record (as in the example you gave)? If there is you will have a whole lot less trouble if you make your USAGE and ACTUAL A25 rather than A25V. If there will be more than one field does the file have a field delimiter?


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
Thanks, all, for your help.
This became one of those classic coding equivalent of the 'Forest 'n' Trees' problem. Looking and looking for the invisible bug that your associate's fresh eyes spot in seconds.
Yep, Susannah, we've all been there many times (See you at the Halloween-eve meeting).

PBrightwell: Yes, only 1 field in this control list.
I'll try fixed length.


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
 
Posts: 154 | Location: NY | Registered: October 27, 2005Report This Post
Platinum Member
posted Hide Post
As PBrightwell suggested, fixed format is needed.

With variable length string specified, the file reading processes use the first 2 characters of the *.text file as the variable-string-length-counter and think the string's content begins at character 3. This causes the output report to truncate the first 2 characters of the data.

Changing to fixed length allows the first 2 characters to become part of the string and it displays as expected.


WIN/2K running WF 7.6.4
Development via DevStudio 7.6.4, MRE, TextEditor.
Data is Oracle, MS-SQL.
 
Posts: 154 | Location: NY | Registered: October 27, 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     [SOLVED] Trying to print a flat file of text

Copyright © 1996-2020 Information Builders