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] Header and Footer in comma separated output file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Header and Footer in comma separated output file
 Login/Join
 
Member
posted
Hi
I am using the comma separated output format (FORMAT COMMA).
But I am not able to add header and footer into it.
Any suggestions?

Thanks
Sid

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


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Virtuoso
posted Hide Post
Header and footer are not meant for csv output. There also is no styling available for a csv file. The only thing you can do with this format is to add the column titles (format comt iso com).
But if you really need some header and/or footer (usually this is the case when you need a start and/or end-record) you can do this with os commands.
For instance, if you need a header record that states how many records there will be in the file, you can create a TABLE request that gives the desired output for the header record and save it to disk. Then you can create the body of the file, and save it. Lastly, create a request that will produce the footer record and save it also. Then use the specific os-command for copying multiple files into one.
Alternatively, you could use the FILEDEF (APPEND option. That way you don't need the os commands to concatenate the files.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Silver Member
posted Hide Post
Another option would be the format WP.
This results in a textfile with formating (heading, page-numbers,footing,...).

Markus


WF 7.6.6 (MRE,BID, DevStudio, partly RC) on Windows 2003 /Apache/Tomcat
Output: HTML,Excel,PDF,PPT
Adapters: SQL Server, DB2, Oracle
 
Posts: 38 | Location: Austria, Linz | Registered: June 19, 2009Report This Post
Virtuoso
posted Hide Post
But if you do that, you would have to construct the record with all comma's in between the fields manually, or place a dummy field with the comma in it between every field in the report. It might be a lot more work to get that right than to simply use a file append.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Member
posted Hide Post
OK, thanks guys,
anyways i am thinking of taking a header and footer in different hold files and merge them.
Can I do that?
If yes then please share a little on how that can be achieved.


PS: Is there anyway to remove spaces between columns?
I tried using 'SET SPACES' but the minimum is one as it takes integer value only

Thanks
Sid

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


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Member
posted Hide Post
I think i'll have to use WP format as I have to include the header and footers.

Any idea on how to remove spaces between columns in WP format?
I tried using 'SET SPACES' but the minimum is one as it takes integer value only

Thanks
Sid


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Virtuoso
posted Hide Post
SPACES, as you noticed, may be set from 1 to 8. 0 is not an option. Not setting it results in 2 spaces.
But why do you think you need to revert to format WP for your header and footer?


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Member
posted Hide Post
Well i need the header and footer without inverted commas and besides that how will I append the files if i have to send them through report caster.
Anyways i have found the solution.
I'll just concatenate all the columns in one Define field and use it.
If you have a better solution always welcome Smiler
Thanks
Sid


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Expert
posted Hide Post
Sid,

There are many previous discussions that would have given you the solution or led you to it.

All you have to do is filedef the file, write the header, place your output into it, write the footer, move/copy it to your desired location (if you haven't filedef'd it directly), job done -

SET MSG=OFF
FILEDEF sidsfile DISK sidsfile.CSV (APPEND
-RUN
-WRITE sidsfile Country,Car,Model,Rcost,Dcost
TABLE FILE CAR
SUM RCOST
    DCOST
 BY COUNTRY
 BY CAR
 BY MODEL
ON TABLE HOLD AS sidsfile FORMAT COMMA
END
-RUN
-WRITE sidsfile There are &LINES Records in this file
CMD TYPE sidsfile.csv


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
Ok thanks man..
anyways one last question..
is there anyway in which I can reduce the left margin to 0..
i mean the text in the HTML should start from the first place itself..
currently its taking 2 spaces by default..


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Expert
posted Hide Post
Always one last question!

I'll tell you what to do.

Give your company my name and tell them to pay me instead of you Wink

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
Expert
posted Hide Post
I'll do it for slightly less than Tony!


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
Expert
posted Hide Post
Cheapskate! Wink
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Member
posted Hide Post
thanks for the encouragement guys Wink
anyways..
i tried using FILEDEF but the thing is that i am not able to write into the file though i have all the rights..
i am getting FOC340 error..

i have tried doing it but help's still needed Smiler
also i'll be distributing it using report caster so will I be able to append the file??

PS: am a little new to this technology..
so might not be as sound as u guys are..

PPS: i can't remove the spaces BTW in WP format..


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report This Post
Expert
posted Hide Post
These three examples each create a hold file where the first row of data contains the column names. Format COMT, COM and COMMA are used. My preference is COMT.

-SET &ECHO = 'ALL';

-*-- Create the extract hold file
FILEDEF HCAR2 DISK C:\ibi\apps\baseapp\hcar2.csv
-RUN

TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR2 FORMAT COMT
END
-RUN

-*-- Add footer
FILEDEF HCAR2 DISK C:\ibi\apps\baseapp\hcar2.csv (APPEND
-RUN

-WRITE HCAR2 "END OF FILE"

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

-SET &ECHO = 'ALL';

TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS H001
END
-RUN

-*-- Create a hold file containing the column names and other attributes of the hold file
CHECK FILE H001 HOLD
-RUN

-*-- Create a hold file containing only the column names generated by the across statement
FILEDEF HCAR1 DISK C:\ibi\apps\baseapp\hcar1.csv
-RUN

?FF HOLD

TABLE FILE HOLD
SUM
FIELDNAME
ACROSS FLDNO NOPRINT
ON TABLE HOLD AS HCAR1 FORMAT COM
END
-RUN

-*-- Create the extract hold file
FILEDEF HCAR1 DISK C:\ibi\apps\baseapp\hcar1.csv (APPEND
-RUN

TABLE FILE H001
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR1 FORMAT COM
END
-RUN

-*-- Add Footer
-WRITE HCAR1 "END OF FILE"

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

-SET &ECHO = 'ALL';

TABLE FILE CAR
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS H001
END
-RUN

-*-- Create a hold file containing the column names and other attributes of the hold file
CHECK FILE H001 HOLD
-RUN

-*-- Create a hold file containing only the column names generated by the across statement
FILEDEF HCAR DISK C:\ibi\apps\baseapp\hcar.csv
-RUN

?FF HOLD

TABLE FILE HOLD
SUM
FIELDNAME
ACROSS FLDNO NOPRINT
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN

-*-- Create the extract hold file
FILEDEF HCAR DISK C:\ibi\apps\baseapp\hcar.csv (APPEND
-RUN

TABLE FILE H001
SUM SALES
BY COUNTRY
BY CAR
BY MODEL
BY BODYTYPE
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN

-*-- Add footer
TABLE FILE CAR
SUM
COMPUTE FOOTER/A15= 'TOTAL SALES:';
SALES
ON TABLE HOLD AS HCAR FORMAT COMMA
END
-RUN


Now, go do your homework Wink


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
Member
posted Hide Post
thanks a ton man..
really really appreciate it..
i got hold of the problem..
i can filedef and append the files now..
Smiler


_________________________________________________________________

WF Server: 7.1.4 on Unix and Win2K3 server, ReportCaster, Self-Service, MRE, Java
Data: Teradata, Oracle, SQL Server Output: HTML,PDF,EXL2K, WP
WF Client: 7.1.4 on Windows 2K3 w/Tomcat
 
Posts: 27 | Registered: August 12, 2009Report 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] Header and Footer in comma separated output file

Copyright © 1996-2020 Information Builders