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     [CLOSED] PCHOLD FORMAT COMMA - Need to remove CRLF at the end of the line.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] PCHOLD FORMAT COMMA - Need to remove CRLF at the end of the line.
 Login/Join
 
Master
posted
I have a report that is putting and output file in COMMA format. I need to get rid of the CRLF at the end of each line. Anyone know how this can be done.

This message has been edited. Last edited by: <Kathryn Henning>,




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Master
posted Hide Post
Actually I need to replace the CRLF that get generated at the end of a line with a space.




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
So you want a CSV with only one line from multiple records ?


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
Gold member
posted Hide Post
Hi,

if you are running WF on a Windows-Server +.NET installed you should be able to use powershell to convert replace the \r\n chars / or join all lines together.

Something like:

 
TABLE FILE CAR
PRINT
  CAR MODEL
ON TABLE HOLD AS H_TMP FORMAT COMMA
END
-RUN

-SET &TMPPATH = TEMPPATH(255,'A255');
-SET &TMPPATH = TRUNCATE(&TMPPATH);

-SET &P='|';
-DOS powershell "[String]::Join(\"\", (Get-Content '&TMPPATH|h_tmp.prn')) &P| Out-File '&TMPPATH|h_tmp2.prn'"

FILEDEF H_TMP2 DISK &TMPPATH|h_tmp2.prn
-RUN

SET HTMLFORMTYPE=TXT
-RUN
-HTMLFORM BEGIN
!IBI.FIL.H_TMP2;
-HTMLFORM END


Should also be possible in on linux / unix using e.g. "cat ... | sed ..."

If you need to have all columns however in a single row and use them again in WebFOCUS, you might come across problems as WF might be limited in the total column length (e.g. to 32k)

Cheers Linne


WebFOCUS 7.7.03
 
Posts: 67 | Registered: January 05, 2011Report This Post
Platinum Member
posted Hide Post
Seem s like their should be something simpler than that


809 DevStudio, MRE, Report Caster , Report Library
Output: Excel PDF, HTML
 
Posts: 171 | Registered: April 28, 2008Report This Post
Expert
posted Hide Post
SQL:
REPLACE(REPLACE(COLUMN_NAME,CHAR(10),' '),CHAR(13),' ') AS NEW_NAME

WebFOCUS:
DEFINE
NEW_COLUMN/A50 = STRREP(50, COLUMN_NAME, 2, HEXBYT(13, 'A1')|HEXBYT(10, 'A1'), 1, ' ', 50, 'A50');


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
I don't think there's anything in WebFOCUS that can help with that as the CSV format as expected by most tools assumes "," to be used as field separator and new line as record separator.

TexasStingray has a particular requirement to get rid of the CRLF and in my experience that can only be done outside of WF via OS tools which is exactly what linnex suggested.

I have this Perl script sitting under a utility app folder in the reporting server:

# Perl Script to remove CR/LF character from a file
# Required to avoid characters automatically added by WebFOCUS
# when creating HTML/HTMTABLE HOLD files with columns that have more than 511 characters.
#
# Usage:  perl D:\ibi\apps\util\remove_crlf.txt <hold-file>
 
use File::Copy qw(move);
 
my $src = "$ARGV[0]" . ".tmp";
my $tgt = "$ARGV[0]";
 
# Rename original file as .tmp
move $tgt, $src or die "Can't rename file: $tgt";
 
open SRC, "<$src" or die "Can't open temporary file: $src";
open TGT, ">$tgt" or die "Can't create target file: $tgt";
 
while (<SRC>) {
   chomp; 
   print TGT ($_);
}
 
close SRC;
close TGT;



Perl is available in most Unix/Linux distributions and since we had it also on our Windows Server it seemed like the right tool to use.

When I have a file whose CRLF characters are to be removed, all I need to do is:

TABLE FILE ..
PRINT ...
ON TABLE HOLD AS HDATA FORMAT HTMTABLE
END
-RUN

-DOS perl &IBI_APPS_DIR\util\remove_crlf.txt  hdata.htm



After that finishes, hdata.htm no longer has CRLF characters in it! This can easily be used on other text-based HOLD files (ALPHA, COMMA, COMT, ...). You'll just have to use the proper file extension (.ftm for instance) when passing the file name as argument to the Perl script.

TexasStringray, you may change the following line in order to get the extra space you need after each record:
   print TGT ($_ . " ");



It may seem like too much but I needed a solution a found no simpler way at that time. Removing extra validations from the script may shorten its length but I'm usually paranoid so I'd rather have them there Smiler

Hope this 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
Virtuoso
posted Hide Post
Tom, that's a very nice way to get rid of CRLF embedded directly in some data fields. I may have some good use for it to deal with some free-entry fields in my DB.



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
Master
posted Hide Post
I ended up creating a JAVA program to replace the CRLF. Now I'll I need to do is figure out how to have WebFOCUS send a TXT file. I know I can use href in an -HTMLFORM tag but the browser opens the file and they would like to download it instead.




Scott

 
Posts: 865 | Registered: May 24, 2004Report This Post
Virtuoso
posted Hide Post
I would use EDAGET for that.

EX EDAGET TXT,yourfile.txt,T



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
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] PCHOLD FORMAT COMMA - Need to remove CRLF at the end of the line.

Copyright © 1996-2020 Information Builders