Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

plsease, some example. followed text.
I can't understand followed text about copy, and can not found some
example.
Please, Anyone write some example.

 ========================================
====================================
====
the source :: http://supportline.microfocus.com/s...2sp1/lrpubb.htm

 ========================================
====================================
====

Each text word copied from the library but not replaced, or only
partially replaced, is copied so as to start in the same area of the
line in the resultant source text as it begins in the line within the
library. However, if a text word copied from the library begins in
area A but follows another text word, which also begins in area A of
the same line, and if replacement of a preceding text word in the line
by replacement text of greater length occurs, the following text word
begins in area B if it cannot begin in area A. Each text word in
pseudo-text-2 that is to be placed into the resultant source text
begins in the same area of the resultant source text as it appears in
pseudo-text-2. Each identifier-2, literal-2, and word-2 that is to be
placed into the resultant source text begins in the same area of the
resultant source text as the leftmost library text word that
participated in the match would appear if it had not been replaced.

If additional lines are introduced into the source text as a result of
a COPY statement, each text word introduced appears on a debugging
line if the copy statement begins on a debugging line, or if the text
word being introduced appears on a debugging line in library text.
When a text word specified in the BY phrase is introduced, it appears
on a debugging line if the first library text word being replaced is
specified on a debugging line. Except in the preceding cases, only
those text words that are specified on debugging lines where the
debugging line is within pseudo-text-2 appear on debugging lines in
the resultant source text. If any literal specified as literal-2 or
within pseudo-text-2 or library text is of too great a length to be
accommodated on a single line without continuation to another line in
the resultant source text and the literal is not being placed on a
debugging line, additional continuation lines are introduced which
contain the remainder of the literal. If replacement requires that the
continued literal be continued on a debugging line, the compilation
group is in error.

Report this thread to moderator Post Follow-up to this message
Old Post
apknight
03-10-05 08:55 AM


Re: plsease, some example. followed text.
apknight wrote:
> I can't understand followed text about copy, and can not found some
> example.
> Please, Anyone write some example.
>
>  ========================================
==================================
======
> the source :: http://supportline.microfocus.com/s...2sp1/lrpubb.htm
>
>  ========================================
 ========================================
[/
color]

Sympathize with you - it is a real mouthful. A repeat of that is in the
Net Express 4.0 manual as well.

Bill, I couldn't find it, but I *know* I've seen a very simple M/F
example, and I think it was for a Personnel Record, where it showed what
happens when copying and replacing.  I didn't get lucky with 'Replacing'
either. Can you help apk ?

I knew I wasn't going mental, (well Personnel is close to Payroll). From
the hard-copy DOS 3.0 Manuals - see if this helps at all :-

(1)----------------------
Source file Code :-

01 Product-Code copy Copyprod:

Copy-file Cosde "Copyprod" :

01 Prod-cd.
05 Item-Name	pic x(30).
05 Iterm-Number	pic x(5).

Resulting COBOL Code :

01 Product-Code.
05 Item-Name	pic x(30).
05 Item-Number	pic x(5).

(2)----------------------

Source-file Code :

copy Payroll Replacing ==(tag)== by ==Payroll==.

Copy-file Code :

01 (tag).
05 (tag)-w		pic s99.
05 (tag)-Gross-Pay	pic s9(5)v99.
05 (tag)-Hours		pic s9(3)
occurs 1 to 52 times
depending on (tag)-w of (tag).

Is treated as if it were coded as :

01 Payroll.
05 Payroll-W		pic s99.
05 Payroll-Gross-Pay	pic s9(5)v99.
05 Payroll-Hours	pic s9(3)
occurs 1 to 52 times
depending on Payroll-w of Payroll.

------------------------------------------------------

If above helps,

COPY - I would suggest golden rule is, to play it safe, always wrap your
copy file in quotes, e.g. :-

copy "myCopfile.cpy".	<----- full pathname - current application
directory is understood in example.

REPLACE - well that is a whole new ball of wax, much more than you are
looking for. I was tempted to show you an example from Jerome
Garfunkel's 'COBOL 85 Example Book' - but BELIEVE ME - you would be even
more  !

Jimmy

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
03-10-05 08:55 AM


Re: plsease, some example. followed text.
apknight wrote:
> I can't understand followed text about copy, and can not found some
> example.
> Please, Anyone write some example.

Here's the way I do it:

1. Highlight the text to be copied.
2. Right-click and select "copy"
3. Open the target file, place the mouse at the desired location
4. Right-click and select "paste."




Report this thread to moderator Post Follow-up to this message
Old Post
HeyBub
03-10-05 08:55 AM


Re: plsease, some example. followed text.
What it is TRYING to say (in general) is:

When you do:

Copy "ABC".   *> Micro Focus extension to '85 Standard to put this in quotes
or
COPY ABC.   *> valid for all '85 Standard compilers

then it will take all the text from copy-member "ABC" (probably "ABC.CPY" - 
but
that may vary) and place it into the source code at this point.

You do NOT need to worry about "margins" and "areas" if you are using defaul
t
Micro Focus settings.  If, on the other hand, you are developing for an
environment (such as IBM mainframes - where A-/B-margins matter) then reply 
to
this note and I can explain what happens then.

If you are doing

Copy ABC
Replacing ==XYZ== by ==123==.

or (and this works EXACTLY the same as above)

Copy ABC
Replacing XYZ by 123.   *> "single words" on each side of the "by"

then it will try and copy in all the text from "ABC" - but it will look for

COMPLETE COBOL WORDS

made up of "XYZ" (no prefixes, middle of words, or ends of words) and if it
finds any, then it will replace them (when doing the copy) with 123.

***

If you want to do PARTIAL word replacing, then you need to use more complex
techniques.  With Micro Focus (current release of Net Express) or with the '
02
Standard, there are TWO ways to do this.  Both are illustrated in the "Langu
age
Reference Manual - Additional Topics" manual - in the SAMPLES section.  To
summarize:

Method 1 (also available with all conforming '85 Standard compilers)
define "text words" by doing something like
01 (TAG)-ABC.
or
05   :SUF:-LMN   PIC X.
in your COPY source code.  (The ONLY valid/portable characters for doing thi
s
are
- left or right parentheses
or
- colon

then use the same COPY REPLACING syntax listed above.

Method 2 (only available with an '02 conforming compiler or as an EXTENSION 
to
the '85 Standard - as Micro Focus has done it)
Use the LEADING or TRAILING syntax in your REPLACING phrase.

***

Bottom-Line:
If the "above" doesn't answer your question, tell me what you actually WANT
to do, and I (we) will tell you how (and if possible)

P.S.  Rules for OTHER compilers may vary slightly.  You quote an MF site, so
that is what I am assuming.


--
Bill Klein
wmklein <at> ix.netcom.com
"apknight" <apknight@gmail.com> wrote in message
news:95895e6d.0503091752.46113a12@posting.google.com...
>I can't understand followed text about copy, and can not found some
> example.
> Please, Anyone write some example.
>
>  ========================================
==================================
======
> the source ::
> http://supportline.microfocus.com/s...ubb
.htm
>
>  ========================================
==================================
======
>
> Each text word copied from the library but not replaced, or only
> partially replaced, is copied so as to start in the same area of the
> line in the resultant source text as it begins in the line within the
> library. However, if a text word copied from the library begins in
> area A but follows another text word, which also begins in area A of
> the same line, and if replacement of a preceding text word in the line
> by replacement text of greater length occurs, the following text word
> begins in area B if it cannot begin in area A. Each text word in
> pseudo-text-2 that is to be placed into the resultant source text
> begins in the same area of the resultant source text as it appears in
> pseudo-text-2. Each identifier-2, literal-2, and word-2 that is to be
> placed into the resultant source text begins in the same area of the
> resultant source text as the leftmost library text word that
> participated in the match would appear if it had not been replaced.
>
> If additional lines are introduced into the source text as a result of
> a COPY statement, each text word introduced appears on a debugging
> line if the copy statement begins on a debugging line, or if the text
> word being introduced appears on a debugging line in library text.
> When a text word specified in the BY phrase is introduced, it appears
> on a debugging line if the first library text word being replaced is
> specified on a debugging line. Except in the preceding cases, only
> those text words that are specified on debugging lines where the
> debugging line is within pseudo-text-2 appear on debugging lines in
> the resultant source text. If any literal specified as literal-2 or
> within pseudo-text-2 or library text is of too great a length to be
> accommodated on a single line without continuation to another line in
> the resultant source text and the literal is not being placed on a
> debugging line, additional continuation lines are introduced which
> contain the remainder of the literal. If replacement requires that the
> continued literal be continued on a debugging line, the compilation
> group is in error.



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
03-10-05 08:55 AM


Re: plsease, some example. followed text.
I am korean(south).. hum.. I can read english.. little...

but...not well write.

I want some example.. I want . show me doing compiler follwed example

d   COPY ABC REPLACING
==:AA:== BY =ABCDE=

OR

COPY ABC REPLACING
d                  ==:AA:== BY =ABCDE=

each case.. Compiler how way include text ABC file to source code.


apknight@gmail.com (apknight) wrote in message news:<95895e6d.0503091752.46113a12@posting.g
oogle.com>...
> I can't understand followed text about copy, and can not found some
> example.
> Please, Anyone write some example.
>
>  ========================================
==================================
======
> the source :: http://supportline.microfocus.com/s...2sp1/lrpubb.htm
>
>  ========================================
==================================
======
>
> Each text word copied from the library but not replaced, or only
> partially replaced, is copied so as to start in the same area of the
> line in the resultant source text as it begins in the line within the
> library. However, if a text word copied from the library begins in
> area A but follows another text word, which also begins in area A of
> the same line, and if replacement of a preceding text word in the line
> by replacement text of greater length occurs, the following text word
> begins in area B if it cannot begin in area A. Each text word in
> pseudo-text-2 that is to be placed into the resultant source text
> begins in the same area of the resultant source text as it appears in
> pseudo-text-2. Each identifier-2, literal-2, and word-2 that is to be
> placed into the resultant source text begins in the same area of the
> resultant source text as the leftmost library text word that
> participated in the match would appear if it had not been replaced.
>
> If additional lines are introduced into the source text as a result of
> a COPY statement, each text word introduced appears on a debugging
> line if the copy statement begins on a debugging line, or if the text
> word being introduced appears on a debugging line in library text.
> When a text word specified in the BY phrase is introduced, it appears
> on a debugging line if the first library text word being replaced is
> specified on a debugging line. Except in the preceding cases, only
> those text words that are specified on debugging lines where the
> debugging line is within pseudo-text-2 appear on debugging lines in
> the resultant source text. If any literal specified as literal-2 or
> within pseudo-text-2 or library text is of too great a length to be
> accommodated on a single line without continuation to another line in
> the resultant source text and the literal is not being placed on a
> debugging line, additional continuation lines are introduced which
> contain the remainder of the literal. If replacement requires that the
> continued literal be continued on a debugging line, the compilation
> group is in error.

Report this thread to moderator Post Follow-up to this message
Old Post
apknight
03-10-05 01:55 PM


Re: plsease, some example. followed text.
Here's an example of a copy replacing.   I needed a copy of a dataset withou
t
packed characters (so I could do an ASCII FTP).

The copy started off with
 ****************************************
**************************
01  EDUSERV-RECORD.
05  LN-DETAIL-RECORD.
10  LN-BORROWER-NAME              PIC X(30).
10  LN-SOC-SEC-NUMBER             PIC S9(09)      COMP-3.
..


The program had the following:

COPY LAMMASTP REPLACING ==EDUSERV-RECORD==
BY ==TAPEOUT-REC==.
/
COPY LAMMASTP REPLACING ==COMP-3== BY ==DISPLAY==.
/
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -   72 Line(s) no
MOVE CORRESPONDING EDUSERV-RECORD TO TAPEOUT-REC

Report this thread to moderator Post Follow-up to this message
Old Post
Howard Brazee
03-10-05 08:55 PM


Re: plsease, some example. followed text.
apknight wrote:
> I am korean(south).. hum.. I can read english.. little...
>
> but...not well write.
>
> I want some example.. I want . show me doing compiler follwed example
>
> d   COPY ABC REPLACING
>                   ==:AA:== BY =ABCDE=
>
> OR
>
>     COPY ABC REPLACING
> d                  ==:AA:== BY =ABCDE=
>
> each case.. Compiler how way include text ABC file to source code.


OK, once more BUT not quite using syntax you have above.

(1)
*>---------------------------------
Program-id. MyProgram.

FILE SECTION.
copy "Customer.cpy" replacing ==(tag)== by ==Customer==.

WORKING-STORAGE SECTION.
copy "Customer.cpy" replacing ==(tag)== by ==WS==.

PROCEDURE DIVISION.
etc......

*>-------------------------------------------------------
(2) the 'Customer.cpy" reads as follows :-

01 (tag)-Record.
05 (tag)-PrimeKey		pic x(06).
05 (tag)-Name		pic x(40).
05 (tag)-CurrentBalance	pic s9(06)v9(02).
05 (tag)-CurrentDate		pic 9(08). *> ccyymmdd
*>-------------------------------------------------------
(3) The first reference in the program above at #1 takes # 2 and gives
following result :-

01 Customer-Record.
05 Customer-PrimeKey		pic x(06).
05 Customer-Name		pic x(40).
05 Customer-CurrentBalance	pic s9(06)v9(02).
05 Customer-CurrentDate      pic 9(08). *> ccyymmdd
*>--------------------------------------------------------------
(4) The second reference in # 1 to Working-Storage will contain :-

01 WS-Record.
05 WS-PrimeKey		pic x(06).
05 WS-Name		        pic x(40).
05 WS-CurrentBalance	        pic s9(06)v9(02).
05 WS-CurrentDate		pic 9(08). *> ccyymmdd
*>-------------------------------------------------------------------
(5) Now when you get a clean compile on the program - if you view your
source you will only see the two references to copying at # 1 above. If
your IDE is like Net Express, if you point individually with the mouse
at each of the copy statements  and hit Alt+F2, you will see the source
expand to show what I have in either #3 or #4.
*>--------------------------------------------------------------------
(6) If you view a copyfile within a program and you try to EDIT it - you
will get a messagebox "Can't edit copy. Do you want to load the original
Yes/No ?". The reason being your Customer.cpy could be included in 10
different programs. So if you respond 'Yes' it loads the original
copyfile for you to Edit and then Save it.

Let's assume you made a typing error and had :-

05 (tag)-CurrentDatEE		pic 9(08). *> ccyymmdd

which you now change to :-

05 (tag)-CurrentDate		pc 9(08). *> ccyymmdd
*>---------------------------------------------------------------------
(7) Having saved the updated copyfile, and assuming you still have it
'open' within your source program - nothing will appear changed - you
will still see "CurrentDatEE". BUT when you re-compile the program and
expand to see the copyfile statements they will NOW appear showing your
changes, i.e. "CurrentDate".
*>-----------------------------------------------------------------------

As Bill said, with Micro Focus you can forget about the A and B areas.
All my programs are written using only Columns 8 through 72.

Does above get you closer to what you want ?

Jimmy

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
03-10-05 08:55 PM


Re: plsease, some example. followed text.
apknight wrote:
> I can't understand followed text about copy, and can not found some
> example.
> Please, Anyone write some example.
>
>  ========================================
==================================
======
> the source :: http://supportline.microfocus.com/s...2sp1/lrpubb.htm
>
>  ========================================
==================================
======
>
> Each text word copied from the library but not replaced, or only
> partially replaced, is copied so as to start in the same area of the
> line in the resultant source text as it begins in the line within the
> library. However, if a text word copied from the library begins in
> area A but follows another text word, which also begins in area A of
> the same line, and if replacement of a preceding text word in the line
> by replacement text of greater length occurs, the following text word
> begins in area B if it cannot begin in area A. Each text word in
> pseudo-text-2 that is to be placed into the resultant source text
> begins in the same area of the resultant source text as it appears in
> pseudo-text-2. Each identifier-2, literal-2, and word-2 that is to be
> placed into the resultant source text begins in the same area of the
> resultant source text as the leftmost library text word that
> participated in the match would appear if it had not been replaced.
>
> If additional lines are introduced into the source text as a result of
> a COPY statement, each text word introduced appears on a debugging
> line if the copy statement begins on a debugging line, or if the text
> word being introduced appears on a debugging line in library text.
> When a text word specified in the BY phrase is introduced, it appears
> on a debugging line if the first library text word being replaced is
> specified on a debugging line. Except in the preceding cases, only
> those text words that are specified on debugging lines where the
> debugging line is within pseudo-text-2 appear on debugging lines in
> the resultant source text. If any literal specified as literal-2 or
> within pseudo-text-2 or library text is of too great a length to be
> accommodated on a single line without continuation to another line in
> the resultant source text and the literal is not being placed on a
> debugging line, additional continuation lines are introduced which
> contain the remainder of the literal. If replacement requires that the
> continued literal be continued on a debugging line, the compilation
> group is in error.
As far as I can make out, this simply explains what happens when you use
the copy <A> replacing <X> by <Y>. It is much as you would expect if you
stop to think about it.
Where the length of <Y> is greater than the length of <X>, the source
line which results from substuting <Y> for <X> might go past the right
hand margin of area B. The long-winded explanation above merely states
that if the line is a normal source line, this is no problem, as the
extra length will be dealt with correctly: it will start in area A or
area B as appropriate, and line continutation will be used if appropriate.
However, if the source line is a debugging line, then line continuation
is not possible. So if the substition of <Y> for <X> would require line
continuation for a debugging line, the program is in error.

Regards,
Mic

Report this thread to moderator Post Follow-up to this message
Old Post
Mic
03-11-05 01:55 AM


Re: plsease, some example. followed text.
There are problems in the COBOL Standard with

D    Copy ABC
replacing ==01 Group1.==  by
==01  Group1.
05  Elem  Pic X.==

Versus

D   Copy ABC
D            replacing ==01 Group1.==  by
D    ==01  Group1.
D              05  Elem  Pic X.==

versus

Copy ABC
replacing ==01 Group1.==  by
D    ==01  Group1.
D             05  Elem  Pic X.==

My recommendation is
DO NOT USE
COPY/REPLACING with debugging lines.

(this area is identified as
"Known errors in the standard"
in the '02 Standard)

If you MUST use Debugging lines with COPY/REPLACING statements, then the onl
y
thing you can do is to TRY it with your compiler and see what it does.


--
Bill Klein
wmklein <at> ix.netcom.com
"apknight" <apknight@gmail.com> wrote in message
news:95895e6d.0503100206.3b03fcb6@posting.google.com...
>I am korean(south).. hum.. I can read english.. little...
>
> but...not well write.
>
> I want some example.. I want . show me doing compiler follwed example
>
> d   COPY ABC REPLACING
>                  ==:AA:== BY =ABCDE=
>
> OR
>
>    COPY ABC REPLACING
> d                  ==:AA:== BY =ABCDE=
>
> each case.. Compiler how way include text ABC file to source code.
>
>
> apknight@gmail.com (apknight) wrote in message
> news:<95895e6d.0503091752.46113a12@posting.google.com>... 



Report this thread to moderator Post Follow-up to this message
Old Post
William M. Klein
03-11-05 01:55 AM


Re: plsease, some example. followed text.
William M. Klein wrote:
> There are problems in the COBOL Standard with
>
>     D    Copy ABC
>                   replacing ==01 Group1.==  by
>              ==01  Group1.
>                       05  Elem  Pic X.==
>
> Versus
>
>     D   Copy ABC
>     D            replacing ==01 Group1.==  by
>     D    ==01  Group1.
>     D              05  Elem  Pic X.==
>
> versus
>
>        Copy ABC
>              replacing ==01 Group1.==  by
>     D    ==01  Group1.
>     D             05  Elem  Pic X.==
>
> My recommendation is
>    DO NOT USE
> COPY/REPLACING with debugging lines.
>
> (this area is identified as
>     "Known errors in the standard"
> in the '02 Standard)
>
> If you MUST use Debugging lines with COPY/REPLACING statements, then the o
nly
> thing you can do is to TRY it with your compiler and see what it does.
>
>
And better yet as he's using Server Express (I think - without checking
back) - he also has Animator (?). Given that tool, for the life of me
can't even think why one would want to give the standard DEBUG syntax
'D' any consideration whatsoever.

Jimmy

Report this thread to moderator Post Follow-up to this message
Old Post
James J. Gavan
03-11-05 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:57 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.