Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: Record Size Adjustment Question

$
0
0

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.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>