Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cobol compress program

Status
Not open for further replies.

Federico64

Programmer
Aug 9, 2001
10
0
0
IT

Hi, I have written a cobol compressor that uses huffman method to reduce file.
It run fine and I am very satisfied of this program.
Is there only a problem. To use it on all platform I have use only cobol standard (bit algoritms are also performed). But when I read my source file to compress it I must read it only a character for time for binary file.
My fd is:
fd file-input.
01 rec-in.
02 car pic x.
and select is file-input organization is binary sequential.

This is not very performant for my program that uses many times to load the file.
Is there another method to run it faster ?.

Thank you
Federico
 
Hi Frederico,

Great that you implemented Huffman in COBOL. I would like to see your source! How many lines of code did you need?

I made a program once to convert DBF files tot TXT and experienced the same problem: byte-wise reading is slow. I used a DOS call to know the exact file length and used the maximum length in my FD to read. That helped a lot. In CA-REALIA I defined the maximum buffer size. That helped also a lot. In the end it was 16 times faster.

There is also a DOS way to read bitewise.

What compiler do you use?

Regards,

Crox

ps. my personal e-mail is behind my profile.
 
Hi Crox.
I'm using powercobol from Fujitsu for new programs and cobol/2 for old procedure.

This program has been written using ONLY cobol standard so more code has been needed to write it. Actually it use 780 lines (include spaces lines...). Using "cbl_call" available on fujitsu cobol and cobol 2 I can use a call to check size file and so use a minimal number of read from stream. I think that I will use this cbl_call
otherwise it make so slow....
There are also call bit features. I have writtend it only in cobol but native call are faster.

I will probably have to start to use out also cobol standard.

Actually he program reduces around 60%, to make it competitive I will have to also use the algorithm of LZH for huffman quickly run I will must to load static codes. Do you know the mechanism of the algorithm huffman?.
 
Hi Frederico,

I am familiar with several compression techniques, but never implemented them myself. Therefore I like it very much that you used COBOL to do this.

Regards,

Crox



 
Federico64,

I too would be interested in your compressor program. I need it in order to pack 35 bytes into a 25 byte field. In this way I will not have to mess up the whole data base.

Respectfully,

Dwight

tec@webworkz.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top