Highlighted
Absent Member.
Absent Member.
2258 views

Record Size Adjustment Question

Jump to solution

I'm currently working in an RM Cobol environment, and working my way into Visual COBOL.


I have a question concerning adjusting the file/record size of existing systems. For example if a record is 1024 Bytes, and more fields need to be added. I currently write a conversion program to convert the file to the new size (Basically creating a new file with the improved layout and moving the old record to the new file). Then I update all the systems that use the file to the new size and layout.

Which can be a pain if its very popular file layout. We don't use copybooks (boss has a horror story about helping a city with Cobol who had sources but all the copy books where missing).

I was just wondering how you could, with Visual Cobol, do the same thing? And how would you track down which programs need to be rebuilt, in a Visual Cobol world. Finding the programs in RM is as simple as doing a search in the Source Directory for all programs that use the name of the file. But since Visual COBOL uses projects ... is there a trick I'm not seeing?

Just decided to get thoughts as I'm about to increase the size of a very popular file(In RM), in many many programs.

Thanks for your input.

Eric Boatman

Tags (1)
0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Record Size Adjustment Question

Jump to solution

Hello Eric,

 

A suggestion about locating the programs that reference a given file. In Visual COBOL for Eclipse, you can search for a string that appears in files in all open projects. This is done using the menu option Search->File (the shortcut for this is CTRL-H), then enter desired string in the "containing text" field . By default, this will search all of the open projects in the current workspace. However, you can also constrain the search to a "working set", which is a subset of projects (for this workspace) that you would have previously defined.

 

Since this will only search open projects, you'll need to first be sure all projects you want searched are open in Eclipse.

Blair McDonald

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Record Size Adjustment Question

Jump to solution

Hi Eric,

 

There is a utility provided with Visual COBOL that includes the ability to expand a file. The utility is named "rebuild". The rebuild utility has many different capabilities, but one of these is to copy an existing file and specify the record length of the newly created copy. This is done using the /r option (use -r on Unix). Here is an example:

 

Let's say I have a file that is 190 bytes in length. I can see a report about the file using the -n option of the rebuild command:

 

$ rebuild -n BLAIRF190.DAT

 

       File                             :   BLAIRF190.DAT

       Organization                     :   Indexed

       Format                           :   IDX-8

       Recording Mode                   :   Fixed

       Compression                     :   N

       Maximum Record Length           :               190

       Minimum Record Length           :               190

       Index Node Size                 :             1024

       Number of data records           :                 1

       Data Created With Extfh Version :             19999

       Last Updated With Extfh Version :             19999

 

       Key Description (where 'Start' is measured from offset 1):

         Key       Start     Length     Dupl     Key Comp   Sparse Char

           0           1         6       N

Now, I can use the -r option of the rebuild command to create a copy of the file with a record length of 200 bytes:

 

$ rebuild BLAIRF190.DAT, BLAIRF200.DAT -r:f200

 

BLAIRF190.DAT, BLAIRF200.DAT -r:f200

Rebuild successful - records read =         1

 

Finally, I can view the information about my new file to confirm the record length:

$ rebuild -n BLAIRF200.DAT

 

       File                             :   BLAIRF200.DAT

       Organization                     :   Indexed

       Format                           :   IDX-8

       Recording Mode                   :   Fixed

       Compression                     :   N

       Maximum Record Length           :               200

       Minimum Record Length           :               200

       Index Node Size                 :             1024

       Number of data records           :                 1

       Data Created With Extfh Version :             19999

       Last Updated With Extfh Version :             19999

 

       Key Description (where 'Start' is measured from offset 1):

         Key       Start     Length     Dupl     Key Comp   Sparse Char

           0           1         6       N

 

There are many options for the rebuild command, and it does require some care in use. One recommended step is to always ensure you have a backup of a file before you attempt to modify it with rebuild. You can find documentation of the rebuild command's options in the Visual COBOL for Eclipse documentation here:

 

Finally, I should mention that by default, the added bytes in an indexed file are filled with hex zeros (low values). As you'll see in the documentation, the -r option does include a way to specify the fill character used.

Blair McDonald

View solution in original post

0 Likes
4 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Record Size Adjustment Question

Jump to solution

Hello Eric,

 

A suggestion about locating the programs that reference a given file. In Visual COBOL for Eclipse, you can search for a string that appears in files in all open projects. This is done using the menu option Search->File (the shortcut for this is CTRL-H), then enter desired string in the "containing text" field . By default, this will search all of the open projects in the current workspace. However, you can also constrain the search to a "working set", which is a subset of projects (for this workspace) that you would have previously defined.

 

Since this will only search open projects, you'll need to first be sure all projects you want searched are open in Eclipse.

Blair McDonald

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Record Size Adjustment Question

Jump to solution

Cool thanks! That worked perfectly.

Is a cobol file conversion program needed or is there a tool to increase the Record Size of an existing file?

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Record Size Adjustment Question

Jump to solution

Hi Eric,

 

There is a utility provided with Visual COBOL that includes the ability to expand a file. The utility is named "rebuild". The rebuild utility has many different capabilities, but one of these is to copy an existing file and specify the record length of the newly created copy. This is done using the /r option (use -r on Unix). Here is an example:

 

Let's say I have a file that is 190 bytes in length. I can see a report about the file using the -n option of the rebuild command:

 

$ rebuild -n BLAIRF190.DAT

 

       File                             :   BLAIRF190.DAT

       Organization                     :   Indexed

       Format                           :   IDX-8

       Recording Mode                   :   Fixed

       Compression                     :   N

       Maximum Record Length           :               190

       Minimum Record Length           :               190

       Index Node Size                 :             1024

       Number of data records           :                 1

       Data Created With Extfh Version :             19999

       Last Updated With Extfh Version :             19999

 

       Key Description (where 'Start' is measured from offset 1):

         Key       Start     Length     Dupl     Key Comp   Sparse Char

           0           1         6       N

Now, I can use the -r option of the rebuild command to create a copy of the file with a record length of 200 bytes:

 

$ rebuild BLAIRF190.DAT, BLAIRF200.DAT -r:f200

 

BLAIRF190.DAT, BLAIRF200.DAT -r:f200

Rebuild successful - records read =         1

 

Finally, I can view the information about my new file to confirm the record length:

$ rebuild -n BLAIRF200.DAT

 

       File                             :   BLAIRF200.DAT

       Organization                     :   Indexed

       Format                           :   IDX-8

       Recording Mode                   :   Fixed

       Compression                     :   N

       Maximum Record Length           :               200

       Minimum Record Length           :               200

       Index Node Size                 :             1024

       Number of data records           :                 1

       Data Created With Extfh Version :             19999

       Last Updated With Extfh Version :             19999

 

       Key Description (where 'Start' is measured from offset 1):

         Key       Start     Length     Dupl     Key Comp   Sparse Char

           0           1         6       N

 

There are many options for the rebuild command, and it does require some care in use. One recommended step is to always ensure you have a backup of a file before you attempt to modify it with rebuild. You can find documentation of the rebuild command's options in the Visual COBOL for Eclipse documentation here:

 

Finally, I should mention that by default, the added bytes in an indexed file are filled with hex zeros (low values). As you'll see in the documentation, the -r option does include a way to specify the fill character used.

Blair McDonald

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Record Size Adjustment Question

Jump to solution

Wow, that is exactly what I was hoping for ...

Its a shame we don't use copybooks, or it would be a simple 5 minute fix for all programs/systems that require a record size adjustment.

Thanks for taking the time to respond, I'm so used to doing this the hardway, I thought I could ask and hope to find a better method.

Which you provided, Thanks again.

Eric Boatman

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.