> -----Original Message-----
> From: IBM Mainframe Discussion List
> [mailto:[email protected]] On Behalf Of ?????? ???????????
> (Nagesh S)
> Sent: Tuesday, November 22, 2011 11:24 AM
> To: [email protected]
> Subject: MD5 hash of a USS file ?
>
> Hi,
> How do I obtain the md5sum of a file located in USS directory ?
>
> I have come across the CSNBOWH callable ICSF function. But, I
> am looking
> for a JCL job step type of solution. In the ported tools
> page, I see a link
> for sha command, but not for md5.
>
> Apology if this question sounds too basic; been a while since
> I have been
> away from z/OS.
>
> N
Java comes with z/OS for "no cost" (other than the CPU to run it). A fast
Google search turned up this code:
import java.security.*;
import java.math.*;
public class MD5 {
public static void main(String args[]) throws Exception{
String s="This is a test";
MessageDigest m=MessageDigest.getInstance("MD5");
m.update(s.getBytes(),0,s.length());
System.out.println("MD5: "+new BigInteger(1,m.digest()).toString(16));
}
}
Put it in a UNIX file named "MD5.java" and compile it with "javac MD5.java".
The result is MD5.class, which you can execute as "java MD5.class input.file"
and it will print out the md5sum of the file. For batch, use JZOS, which comes
as part of IBM's Java installation. Example JCL is in:
/usr/lpp/java/J5.0/mvstools/samples/jcl
--
John McKown
Systems Engineer IV
IT
Administrative Services Group
HealthMarkets(r)
9151 Boulevard 26 * N. Richland Hills * TX 76010
(817) 255-3225 phone *
[email protected] * www.HealthMarkets.com
Confidentiality Notice: This e-mail message may contain confidential or
proprietary information. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original message.
HealthMarkets(r) is the brand name for products underwritten and issued by the
insurance subsidiaries of HealthMarkets, Inc. -The Chesapeake Life Insurance
Company(r), Mid-West National Life Insurance Company of TennesseeSM and The
MEGA Life and Health Insurance Company.SM
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html