On the mainframe, Variable length (VB) files are stored in the following format
Block Length | ||
Record Length | Data Line 1 | |
Record Length | Data Line 2 | |
... | ... | |
Record Length | Data Line n | |
Block Length | ||
Record Length | Data Line n+1 | |
Record Length | Data Line n+2 | |
... | ... |
When the file is transported to another system, the Block Length/Record Length is normally dropped leaving just the data. But you can copy a RECFM=VB file to a RECFM=U and then transport the RECFM=U file (with all the record lengths intact) to a PC/Unix system. The JCL to do this on the Mainframe:
// SET IN=VB.FILE.TO.TRANSMIT // SET OUT=USER.&IN..RECFMU //* //STEP010 EXEC PGM=IEFBR14,COND=(0,NE) //SORTOUT DD DSN=&OUT, // DISP=(MOD,DELETE), // SPACE=(TRK,(30,30),RLSE), // DCB=BLKSIZE=0 //* //STEP020 EXEC PGM=IEBGENER,COND=(0,NE) //SYSUT1 DD DSN=&IN,DISP=SHR,DCB=RECFM=U //SYSUT2 DD DSN=&OUT, // DISP=(NEW,CATLG), // SPACE=(TRK,(115,45),RLSE) //SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //SORTMSG DD SYSOUT=* //SYSIN DD DUMMY |
Then to read it from java. Note: I am using
9: CobolIoProvider ioProvider = CobolIoProvider.getInstance(); 10: AbstractLineReader reader = ioProvider.getLineReader( 11: Constants.IO_VB_DUMP, Convert.FMT_MAINFRAME, 12: CopybookLoader.SPLIT_NONE, copybookName, vendorFile 13: ); or 19: AbstractLineReader reader = LineIOProvider.getInstance().getLineReader(Constants.IO_VB_DUMP);