John,

You can definitely download the alphaWorks JZOS version and use it on
your PC - check the alphaWorks license included in the package.

I don't see how regular expressions apply to this problem.

The issue at hand is that Java keeps "data" in objects; objects have
instance variables (slots) that can be either primitives (int, char,
byte, boolean, long, float, double, etc) or references to other
objects.   Strings are objects (an immutable sequence of chars),
decimal numbers are objects (BigDecimal), and so are Arrays.   A
"record" read into Java from a dataset is a byte array  (byte[]).
If that record is defined by a Cobol copy book or Assembler DSECT,
then you have to somewhere have Java code that converts fields in the
byte array into Java objects (primitives, Strings, BigDecimal objects,
etc) and back again.

JZOS has two things to help with this:

1) "Field converter" classes.   These are classes in the
com.ibm.jzos.fields package, and they can be used to convert fields in
byte arrays into Java primitives and objects.   There are converters
for all of the Cobol and Assembler data types.  The field converter
classes are included in both the SDK and alphaWorks versions of JZOS.

2) Record Generator tools.  These read Cobol or Assember ADATA files
and generate the source code for a Java Class (Bean) that can be used
as a wrapper for a record (byte array).   The generated class will
"layout" the record in terms of configured field converters, and
provide getter and setter methods for each field defined in the
record.   Although these tools are only included in the alphaWorks
version of JZOS, the generated code can run with the SDK version (only
the fields package is used at runtime).

The JZOS Cookbook (available on alphaWorks) has example code and
documentation on using the JZOS Record Generator.   And BTW, this code
runs on any platform although the SDK version is only available and
supported by IBM on z/OS.

Kirk Wolf
Dovetailed Technologies
http://dovetail.com


On Thu, Nov 19, 2009 at 9:32 AM, McKown, John
<[email protected]> wrote:
>> -----Original Message-----
>> From: IBM Mainframe Discussion List
>> [mailto:[email protected]] On Behalf Of Michael Klaeschen
>> Sent: Thursday, November 19, 2009 9:13 AM
>> To: [email protected]
>> Subject: Antwort: How to access FIELDS in a RECORD using
>> Java? (was:RE: How do __you__ read non-DB non-XML files in Java?)
>>
>> John,
>>
>> may be you'll get happy with pattern matching. Have you checked the
>> java.util.regex package already? Try URL
>> "http://java.sun.com/javase/6/docs/api/"; for example. The classes for
>> pattern matching, also known as regular expressions, are
>> ready to use.
>> Well, from my experiences regular expressions are not quite
>> common amongst
>> MVS folks, especially REXX or CoBOL programmers. These have
>> other well
>> working techniques and therefor no need for regular
>> expressions. However,
>> also z/OS Unix has regular expressions available -- a good start for
>> reading might be Appendix C in the z/OS Unix Command Reference.
>>
>> Cheers
>> Michael
>
> I'm a "heavy" Perl coder in Linux. I love regular expressions. I hadn't 
> thought of using them in this context. Something to consider. Also, the 
> current ibmjzos has a LOT more in it that when I first looked at it. It may 
> have everything that I need to get going. Unfortunately, I'm now back at my 
> previous problem of "can I download this jar to my PC in order to do my 
> compiles (not tests!) using it so that management stays off my back"? I can 
> get away with small test runs in the "sandbox". I cannot get away with doing 
> compiles.
>
> --
> John McKown
> Systems Engineer IV
> IT
>
> Administrative Services Group
>
> HealthMarkets(r)
>
> 9151 Boulevard 26 * N. Richland Hills * TX 76010
> (817) 255-3225 phone * (817)-961-6183 cell
> [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
>

----------------------------------------------------------------------
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

Reply via email to