IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Requirement to add a new field to the copybook


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mallem_ravi
Warnings : 1

New User


Joined: 29 Mar 2007
Posts: 10
Location: India

PostPosted: Mon Jun 04, 2007 7:35 pm
Reply with quote

Hi,
i had a requirement to add a new field to the copybook, the length of the filler is not sufficient to add the new field, if i increase the length of the filler in the copybook then i need to compile and retest more than 10 programs which are all using this copybook, for this i want to create a new copybook and add it the required program, can anyone let me know
1) how can i speicfy the new field in the new copybook i.e in 01 level or 05 level
2) what would be the length of the new field.

ex:
copybook: TEX900TS
Code:


01  TEX900-PREMIUM-FILE.                       
                                                   
    05  TEX900-POLICY-NUMBER             PIC X(10).
    05  TEX900-REPORT-BEG-DATE           PIC X(10).
    05  TEX900-REPORT-END-DATE           PIC X(10).
    05  TEX900-STATE-ABBR                PIC X(02).
    05  FILLER                           PIC X(08)


As i am not able to accomodate the new field with the length of 10 in this copybook, i have created a new copybook TEX901TS

Please let any body let me know the code for new copybook TEX901TS
field name is TEX901-DISTICT-CODE PIC X(10).
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Jun 04, 2007 7:55 pm
Reply with quote

Not only recompile but since the lrecl is changing, check jcl and parms....

I looked all through your post and couldn't find a question mark (?)....
Was there a question there?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 04, 2007 8:05 pm
Reply with quote

Hello,

How will a new copybook help? "The" copybook needs to match the actual record layout. Anything (program, sort, or other utility) that uses the file will need to use the new length.

Please clarify your request for the "code for new copybook".
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Tue Jun 05, 2007 12:03 am
Reply with quote

Mallem,

I may not understand your situation well. However, sounds to me like creating a new copybook in order to avoid having to modify/test 10 programs is short-term thinking.

I would suggest: Bite the bullet. Modify/test your 10 programs. Do not create a new copybook.

If you do the short-term painless fix frequently then over time your system will start to acquire a smell.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jun 05, 2007 1:23 am
Reply with quote

Once you have created the new copybook under a different name you would have to change the copy statement in each program, then make the necessary program changes and any necessary JCL and utility statement changes.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 05, 2007 2:20 am
Reply with quote

Hello mallem_ravi,

Is progress being made?

Have we understood your requirement and made any suggestions that will get things done?

Looking back over our replies, i'm unsure whether we've provided the info you were looking for.

Please advise.
Back to top
View user's profile Send private message
mallem_ravi
Warnings : 1

New User


Joined: 29 Mar 2007
Posts: 10
Location: India

PostPosted: Tue Jun 05, 2007 5:37 pm
Reply with quote

Hi Scherrer,
One of the Techie proposed the solution is to create a new copybook(TEX901TS) with the same layout of the existing copybook(TEX900TS) with the additional new field like in the below format.

Code:

01  TEX901-PREMIUM-FILE.                       
                                                   
    05  TEX901-POLICY-NUMBER             PIC X(10).
    05  TEX901-REPORT-BEG-DATE           PIC X(10).
    05  TEX901-REPORT-END-DATE           PIC X(10).
    05  TEX901-STATE-ABBR                PIC X(02).
    05  TEX901-DISTICT-CODE          PIC X(10).
    05  FILLER                           PIC X(08).


and we need to mention the new copybook (TEX901TS) name along with existing copybook(TEX900TS) in the current program, with this there is no need to change and test the all impacted programs which are using the existing copybook, But when ever there is any changes is happend in the existing copybook the same changes should be done in the new copybook.

Thanks
Ravi[/code]
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Jun 05, 2007 6:02 pm
Reply with quote

Ravi,
Could you please explain what have you achieved by using a new copybook? Record length of file is getting increased by addition of a new field, what happens to all the files and programs using old structure?
As Record length is increased, so if suppose same file is being read in a program which uses old structure then how you are going to tackle this situation.
Possible solution:
Increase the record length of 'existing generations/backup' of files.
Initialize the field being added in old generations also.
As TG said :Modify/test your 10 programs. Do not create a new copybook.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 05, 2007 7:09 pm
Reply with quote

Hello,

How will you manage having both copybooks mentioned in any one program?

The "real" file will be one length or the other but will not switch back and forth. When the file itself is expanded, any FD using it (as well as any sort or other utility) will have to be changed at that time - else jobs will terminate with an s013 abend.

Maybe there is something i'm not yet understanding. . . icon_confused.gif
Back to top
View user's profile Send private message
mallem_ravi
Warnings : 1

New User


Joined: 29 Mar 2007
Posts: 10
Location: India

PostPosted: Tue Jun 05, 2007 8:37 pm
Reply with quote

Hi,
sorry for my earlir reply, i have got the correct information now,
We should use only the new copybook TEX901TS in the program, and the output file will create based on the new copybook only, whenever the original copy book is changed then we should also need to change the New copybook.
i have done the changes and got the output. Thanks for all your help
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Jun 05, 2007 9:36 pm
Reply with quote

You're welcome icon_smile.gif

As a bit of a followup question. . .

Are there also 2 physical files? One in the old format and one in the new?

If not, how will a program that compiled with the "old" copybook be able to read a file created with the "new copybook?

If you have what you need, this is good, but i see the potential for problems if the "same" data is created/read by different length copybooks in the different programs. I also do not see how the jcl for the jobs using this file will flip/flop between the file descriptions.

It may also be that i do not completely understand the situation icon_smile.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Trying to change copybook in online c... CICS 4
Search our Forums:

Back to Top