Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COPY Replacing to replace a variable prefix

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Wed Aug 27, 2008 12:09 pm    Post subject: COPY Replacing to replace a variable prefix
Reply with quote

We have copybook variables prefixed as (PFX).

Ex: (PFX)-OCC-SEC X(05).

We need to have the replaced variable as OCC-SEC.

We tried giving, COPY XXXXXXXX REPALCING ==(PFX)-== BY ====

This did not work. It threw a compilation error due to the presence of "-". Please advise.

Thanks.
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 12:15 pm    Post subject: Reply to: Replacing
Reply with quote

Thilak,

Quote:
It threw a compilation error due to the presence of "-".


what was the error? Post the description please

Quote:
COPY XXXXXXXX REPALCING ==(PFX)-== BY ====


Btw, Change "REPALCING" to "REPLACING"
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Wed Aug 27, 2008 12:25 pm    Post subject: Reply to: Replacing
Reply with quote

*** Sorry that was a mistake

It is COPY XXXXXXXX REPLACING ==(PFX)-== BY ====

Error description:

Code:
01  (PFX)-OCC-SEC

"01" was invalid.  Scanning was resumed at the next area "A" item,
level-number, or the start of the next clause.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 12:32 pm    Post subject: Reply to: Replacing
Reply with quote

Thilak,

Few more points.

Do you have a 01 level before the COPY statement. Like


Code:
01 WS-AREA
     COPY XXXXXXXX REPALCING ......



If yes, Do you have a 01 level in your COPYBOOK which is replaced???
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Wed Aug 27, 2008 12:37 pm    Post subject: Reply to: Replacing
Reply with quote

The copybook is like this

Code:
01  (PFX)-OCC-RECORD.
    05  (PFX)-OCC-RECID                        PIC X(03).
    05  (PFX)-OCC-CLEARING-NUM                 PIC X(05).


I need to have the replaced variable as,

Code:
01   OCC-RECORD.
    05  OCC-RECID                        PIC X(03).
    05  OCC-CLEARING-NUM                 PIC X(05).
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 12:44 pm    Post subject: Reply to: Replacing
Reply with quote

Thilak,

You answered my second question.

Answer this one too.

Quote:
Do you have a 01 level before the COPY statement. Like


Post those two lines(COPY statement line and the line above that) from your COBOL code.
Back to top
View user's profile Send private message
thilakvs
Warnings : 1

New User


Joined: 07 Aug 2007
Posts: 27
Location: chennai

PostPosted: Wed Aug 27, 2008 12:49 pm    Post subject: Reply to: Replacing
Reply with quote

It doesnt have 01 variable.

the code is as follows.

Code:
01  HOLD-NEQ-DATE               PIC 9(6).

COPY OPSOCCAL REPLACING ==(PFX)== BY ====.
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 27, 2008 1:40 pm    Post subject: Reply to: COPY Replacing to replace a variable prefix
Reply with quote

Thilak,

Quote:
01 HOLD-NEQ-DATE PIC 9(6).

COPY OPSOCCAL REPLACING ==(PFX)== BY ====.


You have a 01 level variable here and then a 01 level again in a copybook.

Hence after the execution of this statement you will have 2 01 levels and this might be an issue.

Remove the foll statement from the code and try

Quote:
01 HOLD-NEQ-DATE PIC 9(6).


Let us know the findings.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Wed Aug 27, 2008 2:31 pm    Post subject:
Reply with quote

??????????????????????????? <<<<(sarcasm deleted)

a previous 01 level has no effect on a copybook which starts with an 01 level.

dont think you can remove the prefix and the hypen.

you are going to have to generate with a prefix of sometype.

if you read the documentation, the idea behind a prefix was to allow for different prefixes, not a 'NO PREFIX' situation.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Aug 27, 2008 6:09 pm    Post subject:
Reply with quote

If you created the copybook or you can change it, you can do the following: Change all occurrances of PFX:
Code:
05  (PFX)-OCC-RECID                        PIC X(03).
to
Code:
05  (PFX-)OCC-RECID                        PIC X(03).

In the pgm code:
Code:
COPY XXXXXXXX REPLACING ==(PFX-)== BY ====
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Aug 27, 2008 6:21 pm    Post subject:
Reply with quote

Hi,

Hypen is not permitted in RELACING..or should I say they dont' get replaced. I usuall use this -

Code:
COPY XXRPTSUM REPLACING ==:TAG:== BY == ==.


Where XXRPTSUM is like-
Code:
05 :TAG:SUMMARY-DATA.                               
  07 :TAG:SUM-COUNT           PIC S9(03)    COMP-3.


Hope it conveys the message..
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Aug 28, 2008 6:07 am    Post subject:
Reply with quote

You're right, Anju. It's been a while since I used it, and I'm getting old. icon_sad.gif
To get a prefix, code:
Code:
COPY XXRPTSUM REPLACING ==:TAG:== BY ==ABC-==.


You can use hyphens as above. You'll wind upwith:
Code:
05 ABC-SUMMARY-DATA.                               
  07 ABC-SUM-COUNT           PIC S9(03)    COMP-3.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Aug 28, 2008 6:56 am    Post subject: Reply to: COPY Replacing to replace a variable prefix
Reply with quote

Quote:
and I'm getting old.
Beats the alternative. . .
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Thu Aug 28, 2008 11:33 am    Post subject:
Reply with quote

Quote:
You're right, Anju
But you spelled my name incorrectly ..grin...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts replacing junk with hyphen Nitin32 DFSORT/ICETOOL 10 Fri Jun 02, 2017 7:47 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us