× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is simply not true.
Excel allows you to enter Excel identifiers in CSV text files and it interprets
them "correctly". I think his output is simply incorrectly formatted because I
just tried doing what he suggested he was doing and it worked just fine.

-Bob Cozzi
www.i5PodCast.com
Ask your manager to watch i5 TV



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On
Behalf Of rick baird
Sent: Thursday, May 24, 2007 1:38 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: CSV - how to keep leading zeros and alignment problems

I'm afraid you're SOL if you intend on simply opening the file in
excel (open from within excel or by double clicking the .csv). Excel
will format the data the way it thinks it should be formatted, with no
regard to your wishes or hopes.

You can use the text import wizard (data/import external data/import
data - choose text files as your file type) and change the problem
columns to "text" instead of "general", but that is a pain in the
behind.

On 5/24/07, Glenn Gundermann <ggundermann@xxxxxx> wrote:
Seeing that I'm creating a csv file, every field is already surrounded by
double quotes.
Here's a sample of the first five columns:
"025","70010060622","70300457","5507","CO ABC"
"025","70010060620","70300412","MELANIE","CO DEF"

When opening the csv file in Excel, I get:

STATUS PICK TICKET ACCOUNT PO SHIP TO
25 70010060622 70300457 5507 CO ABC
25 70010060620 70300412 MELANIE CO DEF

So you can see I'm missing the leading 0 in the status column, and
the alignment is off for the PO column.

Tks,

Glenn Gundermann
ggundermann@xxxxxx
(647) 272-3295

Booth Martin wrote:
Surround the field with double quotes.

C eval wString = %trim(wString) + ',"' + %editc(Number:
'X') + '"'


Glenn Gundermann wrote:
Hi Everyone,

I haven't ventured into the POI world yet so I'm using RPG to create a
.csv file in the IFS using the unix APIs like open(), write(), etc.

I can't figure out how to keep leading zeros for a numeric field.

An old article of Bob Cozzi in MC Press said to use the quote function,
e.g. =("001") but I get =(001")" in my column. Perhaps the quote
function
will only work for people using CPYTOIMPF.

I've tried putting in an apostrophe in the front. I get '001 in my cell
instead of 001.

Secondly, I have a column (P.O. #) that should be character but the data
sometimes is numeric. The character data is left-justified and the
numeric data is right-justified.

Any help would be most appreciated.

Tks,

Glenn Gundermann
ggundermann@xxxxxx
(647) 272-3295
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.