如何在块处理中实现文件更新逻辑(Java Batch-JSR352) [英] How to implement File Update logic in Chunk Processing (Java Batch - JSR352)

查看:108
本文介绍了如何在块处理中实现文件更新逻辑(Java Batch-JSR352)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用IBM的JSR352实现开发Java批处理程序.由于批处理作业涉及迭代处理大量记录,因此我选择将其实现为块处理"作业.

I am trying to develop a Java batch program using the IBM's JSR352 Implementation. Since the batch job involves iteratively processing huge number of records, I chose to implement it as Chunk Processing job.

此工作涉及3个步骤,对文件1中的每个记录重复进行

This job involves of 3 steps which keeps repeated for each records in File 1

  1. 阅读器类:从文件1读取内容以形成关键文本
  2. 处理器类:在文件2中查找键文本
  3. 作家类:使用自定义文本更新文件2中找到关键文本的文本

从处理器到编写器,我可以返回所有行号,其中 找到了关键文本匹配项.但是,如果没有对文件的RandomAccess,如何 我可以从Writer中更新文件2中的那些特定行号吗?

From the processor to writer, I can return all line numbers where the key text matches were found. But, without RandomAccess to file, how can i update those specific line numbers in File 2 from my Writer?

由于我只能使用

Since I am restricted to use only these Input/Outputstreams for file handling I am unable to split the Lookup & Update logic between processor & writer classes. How can i achieve this ?

这是因为代码将在Windows计算机中开发,但最终在大型机(z/os)服务器中执行.

This is because the code will be developed in a windows machine but, finally executed in a mainframe (z/os) server.

推荐答案

处理器在技术上是可选的,因此您可以仅在writer类中合并查找/更新逻辑.这可能会有所帮助.

The processor is technically optional, so you could merge the lookup/update logic in just the writer class. That might help.

在z/OS上,使用VSAM数据集(也可以通过JZOS ZFile API进行访问)更容易做到这一点.但这将很难在Windows上进行开发/测试.我想您可以分开ZFile调用,并在Windows上用一些经过装配的仿真代替它们,这些仿真可以很好地用于测试目的.

On z/OS this is easier to do with a VSAM dataset (also accessible via the JZOS ZFile APIs). But that's going to be hard to develop/test on Windows. I suppose you could keep the ZFile calls separate and on Windows replace them with some rigged up emulation that would work well enough for testing purposes.

这篇关于如何在块处理中实现文件更新逻辑(Java Batch-JSR352)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆