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

Need to add field to copybook, problem with filler.


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

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 12, 2022 7:30 am
Reply with quote

Hello, how are you.?


Suppose I have this copy.

Code:
01 BIG-FILE.                       
                                                   

    05  TEX-1                                       PIC X(02).
    05  TEX-2                                       PIC X(10).
    05  FILLER                                     PIC X(08).
    05  TEX-3                                       PIC X(02).
    05  TEX-4                                       PIC X(10).
    05  FILLER                                     PIC X(08).



Why is it consider wrong if I add
05 TEX-2A PIC X(2).
and I take bytes from the first filler and not from the last one? Like this:

Code:
01 BIG-FILE.                       
                                                   

    05  TEX-1                                       PIC X(02).
    05  TEX-2                                       PIC X(10).
    05  TEX-2A                                     PIC X(2).
    05  FILLER                                     PIC X(06).
    05  TEX-3                                       PIC X(02).
    05  TEX-4                                       PIC X(10).
    05  FILLER                                     PIC X(08).




THANKS
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu May 12, 2022 9:11 am
Reply with quote

Quote:
Why is it consider wrong


Who said it was?

As long as you populate the new field correctly and all programs know that, what's the problem?
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 12, 2022 8:56 pm
Reply with quote

Phrzby Phil wrote:
Quote:
Why is it consider wrong


Who said it was?

As long as you populate the new field correctly and all programs know that, what's the problem?


But if you take bytes from the middle filler and not from the last one, can doing this modify the layout or anything happens? in my work always say that you have to take the bytes from the filler in the last field of the copybook, so I thought that taking bytes from the filler in the middle of the copybook could entail modify the logic of the copy.
But I see from your words that is indifferent and provoke the same result taking the bytes from any of the fillers
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu May 12, 2022 9:17 pm
Reply with quote

The issues would come in if the new field has a different number of bytes than what is removed from the filler. In such a case, there would be a shift in the data after the FILLER and that means either a conversion program has to be written or the program(s) must be updated to allow for the shifted bytes. As long as the new field byte count is the same as what was removed from the FILLER, you won't see any problems.
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 12, 2022 10:11 pm
Reply with quote

Robert Sample wrote:
The issues would come in if the new field has a different number of bytes than what is removed from the filler. In such a case, there would be a shift in the data after the FILLER and that means either a conversion program has to be written or the program(s) must be updated to allow for the shifted bytes. As long as the new field byte count is the same as what was removed from the FILLER, you won't see any problems.


but when I add the new field all the fields after it will be in another position, so if I have a jcl with a sort this new position will break the logic?

this is right?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Thu May 12, 2022 10:38 pm
Reply with quote

Quote:
but when I add the new field all the fields after it will be in another position, so if I have a jcl with a sort this new position will break the logic?


NO!
now You have
Code:
.... HEAD
... filler x(8)
... TAIL


after you have
Code:
... HEAD
... some field x(2)
... filler x(6)
... TAIL


the important factor is that the sum of the lengths of the substituted fields/fillers
is the same as the length of the original filler
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 12, 2022 10:50 pm
Reply with quote

enrico-sorichetti wrote:
Quote:
but when I add the new field all the fields after it will be in another position, so if I have a jcl with a sort this new position will break the logic?


NO!
now You have
Code:
.... HEAD
... filler x(8)
... TAIL


after you have
Code:
... HEAD
... some field x(2)
... filler x(6)
... TAIL


the important factor is that the sum of the lengths of the substituted fields/fillers
is the same as the length of the original filler


Excuse me, in my mind I was refering to this example:
if I take the bytes from the SECOND FILLER then I see that its going to produce a movement of the fields right to tex-2a. Is this right?

Code:
01 BIG-FILE.                       
                                                   

    05  TEX-1                                       PIC X(02).
    05  TEX-2                                       PIC X(10).
    05  FILLER                                     PIC X(10).
    05  TEX-3                                       PIC X(02).
    05  FILLER                                     PIC X(10).
    05  TEX-4                                       PIC X(10).
    05  FILLER                                     PIC X(10).




Code:
01 BIG-FILE.                       
                                                   

    05  TEX-1                                       PIC X(02).
    05  TEX-2                                       PIC X(10).
    05  TEX-2A                                       PIC X(2).
    05  FILLER                                     PIC X(10).
    05  TEX-3                                       PIC X(02).
    05  FILLER                                     PIC X(8).
    05  TEX-4                                       PIC X(10).
    05  FILLER                                     PIC X(10).
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri May 13, 2022 1:03 am
Reply with quote

Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Sun May 15, 2022 3:43 am
Reply with quote

Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thank you, you are right about this.
Can I ask you if you know some pdf that let me study this matter about how to act when changing a copy?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sun May 15, 2022 4:21 am
Reply with quote

Ali_gezer wrote:
Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thank you, you are right about this.
Can I ask you if you know some pdf that let me study this matter about how to act when changing a copy?


Record Layout in COBOL

Any Google search would return hundreds, or thousands of acceptable references.
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Sun May 15, 2022 5:39 am
Reply with quote

sergeyken wrote:
Ali_gezer wrote:
Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thank you, you are right about this.
Can I ask you if you know some pdf that let me study this matter about how to act when changing a copy?


Record Layout in COBOL

Any Google search would return hundreds, or thousands of acceptable references.


for example that url that you pass doesnt tell nothing about copy modification. I only ask questions on the forum when I do not find information.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Sun May 15, 2022 5:58 am
Reply with quote

Ali_gezer wrote:
sergeyken wrote:
Ali_gezer wrote:
Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thank you, you are right about this.
Can I ask you if you know some pdf that let me study this matter about how to act when changing a copy?


Record Layout in COBOL

Any Google search would return hundreds, or thousands of acceptable references.


for example that url that you pass doesnt tell nothing about copy modification. I only ask questions on the forum when I do not find information.

In order to understand "copy modification" you must first of all understand the record layout ideology.

The rest of understanding is only common sense.

There is no specific manual on "copy modification" available in this world.
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 26, 2022 7:38 pm
Reply with quote

sergeyken wrote:
Ali_gezer wrote:
sergeyken wrote:
Ali_gezer wrote:
Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thank you, you are right about this.
Can I ask you if you know some pdf that let me study this matter about how to act when changing a copy?


Record Layout in COBOL

Any Google search would return hundreds, or thousands of acceptable references.


for example that url that you pass doesnt tell nothing about copy modification. I only ask questions on the forum when I do not find information.

In order to understand "copy modification" you must first of all understand the record layout ideology.

The rest of understanding is only common sense.

There is no specific manual on "copy modification" available in this world.


Yes, I think you are right.
But maybe I was refering to some kind of pdf or article on copy modification behaviour, I read several of this kind of articles in other suspects, but yes I agree with you if I fully learn record layout ideology maybe I can arrive to the answer. I have the murachs cobol book but is sad to admit that only with that information I can handle to know the answer by myself.
Back to top
View user's profile Send private message
Ali_gezer

Active User


Joined: 06 Apr 2021
Posts: 123
Location: argentina

PostPosted: Thu May 26, 2022 7:40 pm
Reply with quote

Robert Sample wrote:
Yes, the fields would move in that case. If you insert a field and you don't take those bytes from the FILLER immediately next to the field, then you will be shifting bytes and that causes issues. But that is not what you asked in your original post.


Thanks.
In that case to avoid issues is it correct to see if there are pgm sort using that old position and cobol programs and correct them?
is there any other thing to have in mind?

thanks again.
greetings.
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu May 26, 2022 7:44 pm
Reply with quote

I would think it's just simple mathematics to add the number of bytes for each field to find the displacement of fields to see if any field in the original structure moves offset. This applies to any structure whether in a copy book or otherwise.,

Garry.
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 Map Vols and Problem Dataset All Other Mainframe Topics 2
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
Search our Forums:

Back to Top