Copybook usage



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Copybook usage

Postby Irene Ioujanina » Thu Feb 21, 2008 6:54 pm

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.
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

 

Re: Copybook usage

Postby arunprasad.k » Thu Feb 21, 2008 8:49 pm

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.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby Irene Ioujanina » Thu Feb 21, 2008 8:56 pm

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?
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby CICS Guy » Thu Feb 21, 2008 9:48 pm

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?
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby Irene Ioujanina » Thu Feb 21, 2008 10:01 pm

Yes, I'd like to WRITE from it to a file.
Thank you,
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby arunprasad.k » Thu Feb 21, 2008 10:09 pm

Irene Ioujanina, You are correct. You can use it to write record to O/P file. Arun.
arunprasad.k
 
Posts: 110
Joined: Thu Dec 27, 2007 5:18 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby CICS Guy » Thu Feb 21, 2008 10:24 pm

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 ====.
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby Irene Ioujanina » Thu Feb 21, 2008 10:44 pm

Thank you very much Mr CICS guy and Arun. :)
Irene Ioujanina
 
Posts: 27
Joined: Thu Feb 21, 2008 6:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Copybook usage

Postby CICS Guy » Thu Feb 21, 2008 10:59 pm

Irene Ioujanina wrote:Thank you very much Mr CICS guy and Arun. :)
As Dick would say, glad to help.....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post