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     CSV File with semi-colon separator

Read-Only Read-Only Topic
Go
Search
Notify
Tools
CSV File with semi-colon separator
 Login/Join
 
<LennyR>
posted
I need to create a CSV file for a European client and they require a semi-colon for the separator, versus a comma. Has anyone created one before?

Thanks in advance,
 
Report This Post
Virtuoso
posted Hide Post
What if you created a variable with the semi-colon in it then did a print of the fields repeating the semi-colon as needed between each field and saved as format alpaha. Could the customer then use the file?


Leah
 
Posts: 1317 | Location: Council Bluffs, IA | Registered: May 24, 2004Report This Post
Expert
posted Hide Post
Perhaps there should be a New Feature Request to have the CDN setting generate semi-colon column separators when it's set to ON.

SET CDN=[ON|OFF]

quote:
The CDN parameter determines whether a numeric value displays with default notation or Continental Decimal Notation. Continental Decimal Notation uses a comma to mark the decimal position in a number, and periods (.) to mark off significant digits into groups of three. The default notation setting uses a period (.) to mark the decimal position in a number, and commas to mark off significant digits into groups of three.


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
Platinum Member
posted Hide Post
Hi LennyR,

I've done what Leah suggested and then run the hold file thru the following perl script:

#!/Perl/bin/perl -w

my $in_file = 'hold_file.ftm';
my $ot_file = 'hold_file.txt';

open(IN,$in_file) || die "Cannot open input file: $!";
open(OT,">$ot_file") || die "Cannot open output file: $!";

my $cnt_recs=0;

while () {
chomp;
my (@in_fields);
my (@ot_fields);
@in_fields = split /;/;
foreach $field (@in_fields) {
for ($field) {
s/^\s+//;
s/\s+$//;
}
push(@ot_fields,$field);
}
my $ot_line = join(";", @ot_fields);
print OT "$ot_line\n";
$cnt_recs = $cnt_recs + 1;
}

print "Number of records converted ----> $cnt_recs\n";

close(IN) || die "Can't close input file: $!";
close(OT) || die "Can't close output file: $!";

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

This perl script:
1) Reads each record from hold_file.ftm (ON TABLE HOLD AS HOLD_FILE FORMAT ALPHA)
2) Splits all the fields into an array
3) Removes leading and trailing whitespace from all fields
4) Joins all fields back together with a ";" as the delimeter
5) Writes each new record to hold_file.txt (could be a .csv file)

This seems to work for me.

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Platinum Member
posted Hide Post
Example using Leah idea:

DEFINE FILE CAR
  DELIMITER/A1 = ';' ;
END

TABLE FILE CAR
  PRINT 
    COUNTRY DELIMITER
    CAR DELIMITER
    SALES
  ON TABLE HOLD FORMAT ALPHA
END
-RUN

Regards,
Mikel


WebFOCUS 8.1.05, 8.2.01
 
Posts: 173 | Location: Madrid, Spain | Registered: May 09, 2003Report This Post
<LennyR>
posted
Thank you all. I think this will take care of my problem.

Sincerely,
 
Report This Post
Member
posted Hide Post
I think all you need is a masterfile with SUFFIX=DFIX where you specify the delimiter as a field at the end of the masterfile like DELIMITER=';'

See the post a few up with subject "$ in a CSV data column causes problems" from Francis Mariani where Susannah posted:

"F, did you try reading the csv via a master that was SUFFIX=DFIX rather than SUFFIX=COM
and put in the field DELIMITER=',' at the end of the master?
that avoids having to SET PCOMMA=ON which does who-knows-what under the covers. old csv files had a $ as the end-of-record indicator, which might be why you're having the problem, but if you read it as a DFIX , you might avoid all that, reading the file as if it were, say, pipe-delimited, just you're using a comma instead of a pipe."

It seems like this would be the way to go for other-than-comma delimited files.

Deb

OH, my mistake, you want to CREATE one, not READ one. Sorry . . . DJ


WebFOCUS 7.6.11 on Win2003 Server
WebFOCUS 7.7.03 on Win2003 Server
Published, AdHoc, ReportCaster
Output in all variants of Excel
 
Posts: 29 | Location: Ravenna, OH | Registered: December 10, 2003Report This Post
<JG>
posted
For future use look at CSVed by Sam Franke

http://home.hccnet.nl/s.j.francke/software/software.htm

It's a freeware program that allows you to do really clever things with csv files
Including changing the delimiter.

No batch option though.
 
Report 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     CSV File with semi-colon separator

Copyright © 1996-2020 Information Builders