I have a COBOL program which performs some common function. This will be used by many users. Because of that input and output file LRECL and other parameters will vary. I have heard about dynamic file creation in COBOL. It would be great if some one gives me the sample code. My JCL code look like this:
Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
First, if you're dealing with fixed length files what you want to do cannot be done in COBOL. It can be done, sort of, with variable length files as long as the COBOL file length is the longest possible length -- 27994 per expat's post -- but if the JCL doesn't have LRECL=27994 you're going to get file status 39 (file attribute mismatch).
Find the COBOL Language Reference in the manual link above and read section 220.127.116.11 on Assignment Name for Environment Variable. This is the only way in COBOL to use dynamic allocation of files.
COBOL isn't really designed for dynamic allocation. This is much more typically done in Assembler, but it's not easy there.
From your description of the requirements, you need to reconsider your language choice and perhaps use REXX instead -- or even ISPF dialogs. Dynamic allocation is easy in SAS, for example.