Skip to main content

This article clarifies VRECGEN in Mainframe Express and Net Express documentation.

Problem:

We have limited access to a host system but must obtain host files by using VRECGEN followed by a FTP download to bring the desired files to a PC or network. How do you properly use VRECGEN?

Resolution:

Various IBM Compiler Options are listed as required and the source code for VRECGEN says to not modify the input and output Cobol FD’s. Over the years IBM has changed their compiler options. This Knowledge Base article will explain what is obsolete and what is required and why.

First, let us begin with the IBM Enterprise Cobol Compiler Options.

CMPR2 and RES are no longer valid compiler options for IBM's latest compilers. So please ignore any references made to them. DATA(24) is no longer required by VRECGEN. DATA(31) can be used.

Second, the IBM Binder module attributes of AMODE(24) and RMODE(24) are no longer required. VRECGEN can use 31/ANY. So, again, please disregard any references to this requirement.

Third, let us discuss what works: changing the Cobol FD in VRECGEN for field INPBYTE from OCCURS 1 TO 32700 TIMES to 'OCCURS 1 TO n TIMES' where 'n' is equal to the record length as defined by the dataset's LRECL minus 4 because in variable length files the dataset LRECL is equal to the record size plus 4 bytes for the system's RDW (Record Descriptor Word). This means that this value must be changed for every dataset that VRECGEN is to process. Although this seems to be a lot of redundant work, it is required because IBM processes DCB attributes in a certain order, that order being:
  1. the program, either a Cobol FD or an Assembler DCB
  2. the JCL's DCB parameters
  3. the DSCB IBM documents this in the z/OS V1R11 DFSMS Using Data Sets manual, Document Number SC26-7410-09, http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DGT2D480/CCONTENTS?SHELF=DGT2BK90&DN=SC26-7410-09&DT=20090522090215 in Chapter 3.2.2.1 Filling in the DCB. See items #1, 2, and 3.

So one can not override the VRECGEN definition of 1 TO 32700 TIMES by coding a JCL statement of DCB=(LRECL=n) where 'n' is the dataset LRECL because IBM always takes the Cobol FD definition first. Pass the IBM Cobol Compiler options of RENT, AWO, NOSSR and either NOOPT or OPT(STD). OPT(FULL) can not be used because it causes the IBM compiler to throw away unreferenced data items and their VALUES. - the output dataset can be left as is, writing out 32700 byte records with a JCL statement of DCB=(RECFM=VB,LRECL=32706,BLKSIZE=32710).

This is because VRECGEN will add a 2-byte length header and we must take into account the system RDW, hence; the LRECL is 32076 (32700 plus 2 bytes added by VRECGEN plus the 4-byte RDW). BLKSIZE can be either 32710 or 0. Using a block size of Zero is recommended because it lets the operating system select the best blocking factor based on the hardware in use. If the output dataset definitions are to be modified then the Cobol FD must reflect the true maximum record length and the JCL definition must use a LRECL = (maximum record length 6 bytes) as explained above.

Incident Number: 2355239

Old KB# 14652

#EnterpriseDeveloper
#COBOL
#Enterprise
#MainframeExpressandMFE
#netexpress
#MFDS