JCL用于运行COBOL程序调用子程序

时间:2011-09-06 09:29:08

标签: cobol mainframe jcl

我有一个COBOL pgm A正在调用另一个COBOL pgm B. 在pgm B我需要一个文件。如何编写JCL以便能够在pgm B中访问此文件?我在B中为此文件编写了select子句和FD条目。

2 个答案:

答案 0 :(得分:6)

对于执行程序A的步骤,您必须在DD statement中加入JCL

如果文件存在,那很容易。

//ABCDEFGH DD DISP=SHR,DSN=your.file.name.here

其中ABCDEFGH是您在程序B的SELECT语句中使用的名称。

如果您要创建新文件,则必须考虑文件将使用的估计空间以及放置文件的位置。

//ABCDEFGH DD DISP=(NEW,CATLG,DELETE),
//            DSN=your.file.name.here,
//            AVGREC=K,
//            RECFM=FB,
//            LRECL=your-lrecl-here,
//            MGMTCLAS=your-management-class-here,
//            SPACE=(your-lrecl-here,(primary-number-of-records,secondary),RLSE)

这只是徒手,你真的应该看一下JCL ReferenceJCL User's Guide

答案 1 :(得分:0)

  1. Include the DD Statement in the step.
  2. Program B does not even have to be COBOL.
  3. Ideally design so that program B is a service program - opens, closes, reads, writes re-writes according to request and your needs. It will make your life a lot easier if this encapsulation is anticipated.

I have seen this where B is assembler and flushes writes to disk periodically when not run interactively, but writes immediately when debugging.