Is it possible to calculate a hash value for a file on the AS/400?

Is it possible to calculate a hash value for a file on the AS/400?
SCDFITAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave FordSoftware Developer / Database AdministratorCommented:
Did you want to calculate the hash-value yourself, or are you looking for some kind of "system-command" that'll do it?
0
SCDFITAuthor Commented:
preferably a system command.  However I am not aware of one.
0
Dave FordSoftware Developer / Database AdministratorCommented:
I'm not aware of any system command to generate one, but there are an infinite number of possibilities that I can come up with (just off the top of my head) to manually calculate one, and I'm sure you can do the same. The algorithm  you choose depends largely on your need to balance its complexity with its "ease of use".

On one end of the spectrum are the algorithms that are "super-simple but not as secure", and at the other end of the spectrum are ones that are "extremely complex, very secure, and very difficult to use". IMHO, the first category usually suffices.

Let us know if you need us to come up with one for you.

HTH,
DaveSlash
0
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

tliottaCommented:
Also, what is "file" and how is the hash intended to be used? Streamfiles could have different hashing possibilities from database files. And SQL tables might have differences from some native physical files. For usage, is the intent to verify file transfers? Or is it just to determine if a change has happened during some time period?

Hashing might not make much sense, depending on intended use. Other system features could make better choices.
0
SCDFITAuthor Commented:
We would use the hash value to determine if a file is in its original state of if at sometime a change had occurred.
0
tliottaCommented:
Yes, but again, what kind of "file"? The system already timestamps the last time any update happens to a data member, so you can know if any updates happened by logging that timestamp. It tracks the numbers of opens and close, writes, updates, deletes, logical and physical reads, and just about everything you could want for every physical database file in it. You can't turn it off.

However, if you really need a "hash" for some reason, try the OpenSSL product in the PASE environment. Run CALL QP2TERM to open an interactive PASE session, then:

==>   openssl sha1 </qsys.lib/myLib.lib/myFile.file/myMember.mbr

Open in new window


For a test, try a file member with a fairly limited number of records. If the physical data size is too large, various techniques handle blocks at a time.

If more details can be given about the "files", better answers are possible. For this, both the OpenSSL product and the PASE system option must be installed. (Free for both.)

Tom
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave FordSoftware Developer / Database AdministratorCommented:
If all you need to know is whether or not a file is has changed, you could pretty easily (and programmatically) gather and compare information such as file-size, last-changed-date, number of records (at least for a native database table), file-level-identifier or member-level-identifier, and record-format.

Of course, that assumes that you're referring to a "native" file ... one that lives in the QSYS.LIB file-system. If you're referring to a file in the Integrated File System, there's whole different set of attributes you can inspect.

HTH,
DaveSlash
0
tliottaCommented:
And of course, journalling the file would show any actual changes. Assuming a fairly static file, receiver sizes should not ever be a problem.

Tom
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IBM System i

From novice to tech pro — start learning today.