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



Scott,

Sorry, forgive my stupidity. Why would someone ever want to left-fill a
character field with zeros? I mean -- from a character field point of
view, the zeros don't mean anything. And you're not populating a
numeric field (or, if you are, there are MUCH better ways).

So... what's up? Is this some weird file format required by a customer?


If I followed the OP correctly, he is parsing a delimited text file so the
"columns" of data have variable length data in them. For each "column", an
initial pass determines the minimum and maximum length of data actually
found in the file for that column. For numeric fields, it also tracks the
maximum number of decimals detected.

Then a second pass standardizes the data in each column to the maximum size
and decimals detected for that particular column during the first pass.
There "coldta" is the contents of a column of data but the size can't be
determined at compile time as in:

D zeros s like(coldta) inz(*zeros)

It is also why the values aren't known at compile time for using some of the
other techniques proposed. Back at V3R2, we had subprocedure support but
not the %editc() and similar BIFs. So among the various string handling
routines I wrote for a service program were some which tried to mimic the
%editc() and %editw() in V3R7. However, since operational descriptors were
not available for numeric fields, I had to pass the field's length and
decimal positions to my routine. It then used QECCVTEC to create the "edit
mask" and QECEDT to perform the actual editing of the data, which got
returned as a string.

What I don't get here is why it is desirable to standardize the columns into
what in essence is fixed width sizes with leading or trailing zeros, up to
the maximum length of any data in that "column".

Doug

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.