Search code examples
db2coboljclcics

Dynamic file creation in COBOL/JCL


I have an requirement, Where I have to read DB2 table and create multiple output file, one for each program name in the table. We don't know how many unique program name in the table. My job will run every 4 hrs. So for eg: my first run may have 10 program name and I will have to create 10 output file and second run may 20 program name and 20 output files.

I'm looking for a dynamic way to create DD name and file name in the JCL as well in my COBOL program. So I don't want to define 20 or max DD statement in my JCL, as this 20 can be 50,60....

Please help me with the possibilities.


Solution

  • One option is BPXWDYN, which is callable from COBOL, et. al. A COBOL example is here.