COBOL program, JCL job, or both?

心不动则不痛 提交于 2019-12-06 15:08:13

You cannot perform these tasks with just JCL, JCL (mostly) just causes programs to execute. To be completely accurate, JES performs these functions as it interprets JCL.

Now, you can avoid writing a program by using an existing utility or set of utilities.

SyncSort, for example, can execute a SELECT statement and write the results to a file.

DSNTEP4, for example, can execute SQL statements in batch that include DELETE, UPDATE, and INSERT statements.

So you could do this without writing a COBOL (or Assembler, or PL/I, or C/C++, or Rexx, etc.) program, just not without executing a program.

You cannot write a program in JCL to do what you need since JCL is designed for defining and submitting jobs, not general purpose programming. You can use any supported Mainframe language to access DB2, so you can write a program in COBOL, Java, C, C++, etc. You would then need to write JCL to execute that program. The JCL would list any required information such as parameters for your program, as well as the datasets it required for input/output.

DB2 (and most other databases) have batch or command line utilities that can run arbitrary SQL statements via JCL. This is the simplest way to go, requiring nothing but JCL and some control statements. You may also have some DB2 management tools from CA, BMC or IBM that also allow arbitrary queries to be processed. The trick is expressing your requirements as a SQL query, with no additional logic (which I believe is definitely possible, given the requirements you've documented).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!