Page 1 of 1

Copybook usage

PostPosted: Thu Feb 21, 2008 6:54 pm
by Irene Ioujanina
Hello,
May I please ask for help...
I use a copy code in my Cobol program like:

COPY CCPC0010 REPLACING ==:CCPC0010:== BY ==CEPSOSFI==
==:PFX:== BY ==WS-EPSSB==.

But there are 2 fields at the end of the layout that I don't need and would like to delete- so the record will become smaller by 2 fields... Is it possible in Cobol to use a copybook AND delete some fields from the copybook, let's say 2 last fields?

This is that I have in the compiled program after I included the st-t " COPY CCPC0010......" :
01 CEPSOSFI-PARAMETERS.
05 WS-EPSSB-PERSONAL-NAME.
10 WS-EPSSB-LAST-NAME PIC X(20).
10 WS-EPSSB-GIVEN-NAMES PIC X(40).

05 WS-EPSSB-NON-PERSONAL-NAME REDEFINES
WS-EPSSB-PERSONAL-NAME.
10 WS-EPSSB-ENTITY-NAME PIC X(60).
05 WS-EPSSB-CUST-ADDRESS PIC X(60).
05 WS-EPSSB-APPLICATION PIC X(10).
05 WS-EPSSB-UNIQUE-ACCOUNT-KEY PIC X(20).
05 WS-EPSSB-ENTITY-FLAG PIC X.
88 WS-EPSSB-PERSONAL VALUE 'P'.
88 WS-EPSSB-BUSINESS VALUE 'B'.
05 FILLER PIC X(43).
05 WS-EPSSB-SYSTEM-ID PIC X(3).

And I want the WS-EPSSB-ENTITY-FLAG be the last field of the layout- so I need to delete somehow the last 2 fileds : FILLER & WS-EPSSB-SYSTEM-ID...

Is it possible??? iF YES, HOW i CAN DO THAT?

Thanking in advance.

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 8:49 pm
by arunprasad.k
You can very well!! :D

I am not sure if I understood your requirement, but here is what I have to say.

You have a copy book (say COPY01) with the following contents and you do NOT want C and D. I really do NOT understand why you do not want C and D!!

01 WS-RECORD.
     05 A               PIC X(01).
     05 B               PIC X(01).
     05 C               PIC X(01).
     05 D               PIC X(01).


Then you can do something like.

COPY COPY01.
01 REDF-RECORD   REDEFINES WS-RECORD PIC X(02).


Now use REDF-RECORD instead of WS-RECORD.

If this is not what you are looking for, then clarify us on what you exactly want.

Arun.

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 8:56 pm
by Irene Ioujanina
Thank you, Arun, for the answer.

Yes, you inderstood it correctly.

So the copycode REDF-RECORD will have something like:
01 REDF-RECORD.
05 A PIC X(01).
05 B PIC X(01).
Is it correct?

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 9:48 pm
by CICS Guy
Irene Ioujanina wrote:And I want the WS-EPSSB-ENTITY-FLAG be the last field of the layout- so I need to delete somehow the last 2 fileds : FILLER & WS-EPSSB-SYSTEM-ID...
Why do you even care if they are there? Are you using the definition for an output record?

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 10:01 pm
by Irene Ioujanina
Yes, I'd like to WRITE from it to a file.
Thank you,

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 10:09 pm
by arunprasad.k
Irene Ioujanina, You are correct. You can use it to write record to O/P file. Arun.

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 10:24 pm
by CICS Guy
Try this:
 COPY CCPC0010 REPLACING ==:CCPC0010:== BY ==CEPSOSFI== 
                        ==:PFX:==      BY ==WS-EPSSB==
                        ==05 FILLER PIC X(43).== BY ====
                        ==05 WS-EPSSB-SYSTEM-ID PIC X(3).== BY ====.

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 10:44 pm
by Irene Ioujanina
Thank you very much Mr CICS guy and Arun. :)

Re: Copybook usage

PostPosted: Thu Feb 21, 2008 10:59 pm
by CICS Guy
Irene Ioujanina wrote:Thank you very much Mr CICS guy and Arun. :)
As Dick would say, glad to help.....