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



Hi Frank

It sounds like you want to keep all the data but put it into half-as-long records - is this true? There is no way a CPYF will break the long rows into shorter rows, like folding them or some such.

Also, is there any kind of order it needs to be in? Such as, does the 1st record need to be copied to the 1st 2 records in the shorter file, with the 1st half, then the 2nd half?

Or do you want only the 1st 100 characters in the new file?

If you want all the data and order does not matter, then you could do a couple things with SQL - first, you have the shorter file created. Then try this -

insert into shortone (select left(longfield, 100) from longone)

Then do this -

insert into shortone (select right(longfield, 100) from longone)

Now i don't remember if SQL has an issue with flat PFs - those created without source. I am pretty sure it can read it, not necessarily write to it - so you would want to make the target file either using CREATE TABLE in SQL or from DDS.

Now if order matters, I can see how you could extract something from the long file like this -

First, create a table with 3 columns, an integer, a single character, and a 100-character field. Then insert into that table using this select -

(Select rrn(longone), 'L', left(longfield, 100) from longone union
select rrn(longone), 'R', right(longfield, 100) from longone )

Then try this -

insert into shortone (select field3 from workfile order by 1, 2)

I really don't know for sure that will work, but another way is to populate the workfile, then use SQL to delete the 1st 2 columns - again, you're not guaranteed the order.

Might be easier to write a program to do exactly what you want - that depends, again, does order matter and do you want both halves of the long one?

Good luck
Vern
On 2/10/2022 9:45 AM, frank boke wrote:
Alan...you too...thanks for thinkin on this one.

On Wed, Feb 9, 2022 at 3:45 PM frank boke <fboxxx1958@xxxxxxxxx> wrote:

Hi Folks, I'm looking for an easy way out or a trick that you folks might
have to avoid CPF2973 which is the commonly seen msg when copying from 1
file to another where the input file has a larger record length than the
output. Is there any way to keep the output file with a smaller recl and
avoid truncation? I didn't think so but I figured if anyone would have
ways around this or a quick way to avoid it I'd be happy to hear any.
Thanks, Frank



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.