Thanks for all the messages. I suspected it was not possible but good to confirm.
Modern I.T. seems to be 95% "inheriting" other things - its too bad COBOL doesn’t seem to support much of that. Maybe that’s why most of the COBOL programs here are 5000+ lines long :(
I suspect inheritance wasn’t such a focus back in the 1970's.
-----Original Message-----
From: COBOL400-L [mailto:cobol400-l-bounces@xxxxxxxxxxxx] On Behalf Of Basil Zangare
Sent: Thursday, November 17, 2016 2:37 PM
To: cobol400-l@xxxxxxxxxxxx
Subject: Re: [COBOL400-L] can COPY ... REPLACING replace colhdg and text and alias verbiage when it gets field info from a referenced field?
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.