HP3000-L Archives

March 2002, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Pollard <[log in to unmask]>
Reply To:
John Pollard <[log in to unmask]>
Date:
Tue, 26 Mar 2002 13:37:21 -0500
Content-Type:
text/plain
Parts/Attachments:
text/plain (71 lines)
Tracy writes:
<snip>
what I want is COPY ACTIV
REPLACING ==AC-== BY ==AX-==.  gets me no changes, as is predicited by the
excellent docs.  got a hint?
<snip>



I have not tried it with COPY REPLACING but I have tried it with the
REPLACE statement.  And you can do it: one way is certain (because I do it
that way), the other way is only per HP Cobol documentation (I have not
tested it).

In your primary $INCLUDE file, instead of the prefix you want to see in the
finished Cobol code, use the same number of exclamation points ("!") as
there are characters in your desired prefix.  (You do not have to use the
exact same number - it just helps maintain alignment).

 01  ACTIVITY-RECORD.
     05  !!-VEH-OR-UNIT.
         10  !!-UNIT-TYPE.
             15  !!-VEH-NO           PIC 9(4).
             15                      PIC X(4).
         10  !!-UNIT-SER-NO          PIC X(10).
     05  !!-ACT-CODE                 PIC X(6).
     05  !!-COMPL-CODE               PIC XX.
     05  !!-ROAD-CALL                PIC XX.

*If* it will work with COPY statements, then you would say
COPY  ACTIV  REPLACING  ==!!==  BY  ==AX==.

 But, since I use $INCLUDE files, I would save ACTIV as ACTIV1.INC (for
example), then
create another file called ACTIV.INC with contents like this:
     REPLACE  ==!!==  BY  ==AC==.
$INCLUDE   ACTIV1.INC
     REPLACE  OFF.

Then for the default prefix I would just say:
$INCLUDE  ACTIV.INC
But when I wanted a different prefix I would say:
     REPLACE   ==!!==   BY   ==AX==.
$INCLUDE   ACTIV1.INC
    REPLACE   OFF.

A quick glance at HP's online Cobol documentation seems to say that you can
accomplish the same thing by enclosing the desired replaceable characters
within parentheses, leading to:

01  ACTIVITY-RECORD.
     05  (AC)-VEH-OR-UNIT.
         10  (AC)-UNIT-TYPE.
             15  (AC)-VEH-NO           PIC 9(4).
             15                      PIC X(4).
         10  (AC)-UNIT-SER-NO          PIC X(10).
     05  (AC)-ACT-CODE                 PIC X(6).
     05  (AC)-COMPL-CODE               PIC XX.
     05  (AC)-ROAD-CALL                PIC XX.


And in your program:
COPY  ACTIV  REPLACING  ==(AC)==  BY  ==AX==.
or
    REPLACE  ==(AC)==  BY  ==AX==.
$INCLUDE  ACTIV1.INC
    REPLACE  OFF.

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2