We have used the MQ utility CSQUTIL to copy the messages from a local queue (MQ) to a GDG file which has below declaration in JCL. Now, we have been requested to write a new COBOL-MQ to program to copy the messages from the local queue which has maximum length of 4194304 and to write the same to a GDG file as it is doing for CSQUTIL:

Could you please help me in providing the COBOL FD File declaration for RECFM=VBS to write records with maximum length of 4194304 bytes ?

Find the Language Reference manual for the version of Enterprise COBOL you have and peruse Appendix B Compiler Limits. You will discover that an FD entry (at least for the 5.2 version) can be no more than 1,048,575 bytes -- but note 5 applies and indicates that 1048575 is a compiler limit and QSAM limits you to 32760 bytes. In other words, it is not possible to use a record length of 4194304 in COBOL on z/OS.

Thanks for your update. Could you please provide the FD File Declaration based on the below GDG file details used in JCL since this is the first time to work in batch program. So that I can give a try to execute and see..

Hopefully, you realize by now that any record over 32760 bytes long may not be readable on the mainframe. I wrote a program a few years back to read SMF data, which is VBS as well. The COBOL declarations for that data set are:

The DD statement you show may not be valid anyway. A VBS data set opened for output must specify an LRECL that specifies the maximum length logical record you intend to write.

In theory an Assembler program can read or write variable length logical records > 32767 bytes, but I never got anything like that to work, though I'll admit I didn't try very hard.

I've done a number of Assembler programs to read and/or write SMF data. I specify LRECL=32767 in the program's DCB macro when writing SMF data - JCL won't accept the value - and don't have any real trouble. What Cobol does I have no idea.