× 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 only time I could get it to work was when I set up a copybook for file statuses that I would use multiple times in a program. The text would need to include parenthesis.

05 (filename)-RECORD-FOUND ....

COPY STSFILE REPLACING ==(filename)== BY ==EMP==

Gives you:

05 EMP-RECORD-FOUND ....

I wanted t show you this s you get an idea of what's required to get it to work. If you are look to rename the fields in a file so they have unique names from fields in other files that are named the try using the PREFIX BY in your copy statement.


05 RECORD-FOUND ....


COPY STSFILE PREFIX BY "EMP-".

Gives you:

05 EMP-RECORD-FOUND ....

But this gets applied to every field name in the file or copybook. Depends on what you what you need to do.


-----Original Message-----
From: MichaelQuigley <MichaelQuigley@xxxxxxxxxx>
To: cobol400-l <cobol400-l@xxxxxxxxxxxx>
Sent: Thu, Nov 17, 2016 12:58 pm
Subject: Re: [COBOL400-L] can COPY ... REPLACING replace colhdg and text and alias verbiage when it gets field info from a referenced field?

"COBOL400-L" <cobol400-l-bounces@xxxxxxxxxxxx> wrote on 11/17/2016
01:00:31 PM:
----- Message from "Stone, Joel" <Joel.Stone@xxxxxxxxxx> on Thu, 17
Nov 2016 17:53:20 +0000 -----

To:

"'COBOL Programming on the IBM i (AS/400 and iSeries)'" <cobol400-
l@xxxxxxxxxxxx>

Subject:

[COBOL400-L] can COPY ... REPLACING replace colhdg and text and
alias verbiage when it gets field info from a referenced field?

I cant get it to work. Is this possible???

Thanks in advance.



Unfortunately, no. Here's the description of the replacing phrase from the
manual:

Pseudo-text-1 must contain, as a minimum, a text word. Since text words,
by
definition, are bounded by separators, pseudo-text cannot be used to
select
part of a word for replacement (for example, a prefix in a data name): a
complete text word must be used in order to find a match. It is possible,
however, to simulate the partial replacement of a text word held in the
library
text, by dividing it into two or more text words using separators that are
used
only for matching purposes, and not copied into the source program. For an
example of this method, refer to “Coding Examples” on page 607.

If your ALIAS name had something else as a text separator, it could do it.
But then it wouldn't be valid in it's un-replaced state--at least not for
DDS. If you wanted to use an actual source copy member, you could. But the
inconvenience of maintaining the copy members to use for data definition
and specifying the replacing phrase everywhere you use it wouldn't be
worth the effort--at least not to my mind.

I've often wanted to do this, too. You could try an RFE, but COBOL RFEs
generally don't get much traction.

Michael Quigley
Computer Services
The Way International
www.TheWay.org
-- This is the COBOL Programming on the IBM i (AS/400 and iSeries) (COBOL400-L) mailing listTo post a message email: COBOL400-L@midrange.comTo subscribe, unsubscribe, or change list options,visit: http://lists.midrange.com/mailman/listinfo/cobol400-lor email: COBOL400-L-request@midrange.comBefore posting, please take a moment to review the archivesat http://archive.midrange.com/cobol400-l.

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.