× 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.



The CPYFRMIMPF now has a parm to replace the null entries with default
value.
CPYFRMIMPF FROMSTMF(streamfile.csv)
TOFILE(PHYSICAL)
RPLNULLVAL(*FLDDFT)

----- Original Message -----
From: <Peter_Vidal@xxxxxxxx>
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, May 26, 2009 8:34 AM
Subject: Re: upload Flat file (comma seprated ) taken from XLS to Physical
File


You can probably use either the CLIENT ACCESS' - DATA TRANSFER TO iSERIES
Tool. With this, you can easily build a physical file on the iSeries and
load it with your comma delimited file. Just use the wizards to help you
do it one step at a time.

I also have a note about the CPYFRMIMPF command. However, this command
will not work if any of the fields in the .CSV file are blank or zero. The
record looks something like this:

73,"1","1","","4",0,0,"","W 13","","",0
73,"1","1","","5",0,0,"","W","","",0
73,"1","1","","6",0,0,"","W","","",0
73,"1","1","","7",0,0,"","W","","",0
73,"1","1","","8",0,0,"","W","","",0
73,"1","1","","9",0,0,"","W","","",0

To get around this limitation:

Define another physical file, using DDS, identical to the one you want to
copy to, but add the ALWNULL keyword to all fields which could be blank or
zero.
Use Client Access to transfer the spreadsheet, which is in .CSV format, to
a flat file (which you can let CA create for you).
Use the CPYFRMIMPF command to copy the flat file to the new created file
with the null capable fields. (We can use the default delimiters of a
double quote for STRDLM, and a comma for FLDDLM.)
Copy the records from that file to my "regular" file (the one without the
null-capable fields) with CPYF FMTOPT(*NOCHK). The data will be in the
non-null-capable-field file correctly. The null fields in the .CSV will be
blank or zero.

Note: The companion command CPYTOIMPF will not produce a file with null
fields in it; numeric fields with zero values will have a zero. For
example, an amount field would have ".00 ", and blank character fields
will have blank spaces filling the length of the field.

PETER VIDAL
MAPICS IT TECHNICAL SUPPORT TEAM / SR SYSTEM ANALYST
10540 Ridge Rd., Suite 203, New Port Richey, FL 34654-5111
Tel:727-849-9999, x2414 /// Fax:727-815-3120
WWW.PALL.COM

"We find no real satisfaction or happiness in life without obstacles to
conquer and goals to achieve."
Maxwell Maltz, Communication Bulletin for Managers & Supervisors, June
2004

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

Attention:

This communication may contain information that is confidential,
privileged and/or exempt from disclosure under applicable law.
If you are not the intended recipient, please notify the sender
immediately and delete the original, all attachments, and all
copies of this communication.


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

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.