import not exacting?

Kenneth Brody kenbrody at spamcop.net
Tue May 6 14:39:18 PDT 2014


On 5/6/2014 4:14 PM, Fairlight wrote:
> On Tue, May 06, 2014 at 02:14:37PM -0400, Kenneth Brody thus spoke:
>>
>> Can you show the actual processing?  A simple import ascii will not
>> strip any leading zeros, unless you put the result into a numeric
>> field.
>
> Unfortunately, no.  NDA.

What about a similar piece of code?

Why not a simple:

     IMPORT ASCII imp=/path/to/file.txt f=, r=\n

And a file containing something like:

     new york,ny,12345
     boston,ma,02134
     fooville,me,00111

Does this import as expected?  (ie: with the leading zeros in the zipcode.)

>>> I'm getting very lucky that lookups seem to match on key field, even with
>>> this screwy non-literal lead-zero translation.  It's always worked, so it's
>>> gone unnoticed until now.  But technically it should always be five digits,
>>> even uncast.
>>
>> Can you double-check that the field is not a numeric field?  That
>> would explain both scenarios.
>
> It's definitely not cast to anything.  "declare LAZip"  That's it.  What
> was -more- interesting was when I tried to put in a single looping line of
> logic to prepend zeroes on with concatenation if the length was < 5, it
> refused to trigger.  Bizarre.

Without some code that shows it, even if it's just a snippet of a few lines 
of the import statement itself, and the assignment that "fails", along with 
a sample line of import, then there's not much I can say other than "you're 
doing something wrong".  ;-)

For example, the above 3 lines of data, the IMPORT line, and a simple 
assignment of "LAZip=imp[3]", results in LAZip containing the full 5-digit 
zipcode, including leading zeros.

-- 
Kenneth Brody


More information about the Filepro-list mailing list