WebSphere Application Server & Liberty

Jakarta Batch Post 129: JSL Inheritance

By David Follis posted Wed March 17, 2021 08:05 AM

This post is part of a series delving into the details of the JSR-352 (Java Batch) specification. Each post examines a very specific part of the specification and looks at how it works and how you might use it in a real batch application.

To start at the beginning, follow the link to the first post.

The next post in the series is here.

This series is also available as a podcast on iTunesGoogle PlayStitcher, or use the link to the RSS feed

The issue can be found here.

Your long lost uncle has passed away and left you a big pile of JSL in his will, but wait ‘till you see the tax on inherited JSL!

No, not really.  So what do we mean by JSL inheritance?  Basically it means being able to include JSL from other files into the one being processed.  You’d want to do this if you have standard steps used across a lot of different jobs and you don’t want to maintain numerous copies.  Those with a z/OS background will recognize this as a JCL PROC. 

In its most simple form, we’d introduce some new syntax into JSL to allow you to specify the name of another JSL file to go fetch and include as if it was found right here in the JSL file being read.  Right away this raises some questions.

Where would we go look for such a file?  Would it have to be in the same location as the original JSL file was found or could you specify a path to find it?  Would there be some sort of standard ‘search’ path we’d look through (like a JCL PROCLIB DD..if that helps anybody).

Presumably the included JSL would just be a set of step elements.  Would the included segment have an id value so that flow control could just branch to whatever was found first inside the included file or would you need to know an id from inside it in order to flow into the steps?  How do you leave the included segment?  Would some flow control inside that file need to know an id of an element outside of it?  Or would it just run the included segment until it ran out of steps and then…do something else?  Would the include element specify where to go when it ended?  Have some sort of ‘decider’ like capability? 

Could you include a JSL file from within an included JSL file?  If so, how many layers in can you get?  Can you have a circular include (hopefully not, but what happens if you try)?  Can you have conditionally included JSL? 

What about parameters?  Can you specify parameter name/value pairs to be passed into included JSL?  Would included JSL be able to use parameters known outside the included segment?  Do you have to include a full step, or could you, for example, specify a chunk step but include the reader/writer/processor? 

At a high level it seems like you’d just go read the included file when you’re reading the initial JSL and then treat it all like one big JSL file, but I think in practice it gets a lot more complicated.  Feels like it could be really powerful, but there are a lot of rules to be worked out.