Can't read Variable Block Mainframe file

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Can't read Variable Block Mainframe file

Post by pradkumar »

Hi All,

I am new to COBOL and I have been struggling for a week. I have a Variable Block file and 3 copybooks (header, detail and trailer) from our Mainframe guy. The record length in Mainframe shows 27840 bytes ( I guess it means maximum length for VB format). I created 3 COBOL FD by using the copybooks.

In CFF stage, I noticed the total length of all columns is 40 bytes for header, 930 for detail and 136 for trailer. I tried to configure CFF stage in many ways and I can't read the file.

File Options: Record Type - Variable/Variable Block
Record Options: Byte Order -Native-endian; Data format- binary ; Character set: EBCDIC.
Records ID: RECORD_TYPE='H'
RECORD_TYPE_2='D'
RECORD_TYPE_3='T'

Can anyone help me with this? Thanks in advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Have you checked this FAQ?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Post by pradkumar »

Yes, Craig. I have read the FAQ and also searched in forum about Mainframe and COBOL before I posted this. Although I learned a lot from that, i still can't figure out my problem.

In FAQ, it says mainframe variable length data has the usual attributes: a field containing the actual length of the field or record followed by the data.

But the file doesn't have such a field.

Thanks for any help
Pradeep Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

pradkumar wrote:the file doesn't have such a field
Then it sounds like you may not have a "variable block" file. I'm not the best one to help for stuff like this, I've done more than my share of COBOL in the past but never actually got any hands on time with the CFF stage and not done much mainframe stuff either. You'll need to wait for other more helpful types to wander along, which may not happen over the weekend. FYI.
-craig

"You can never have too many knives" -- Logan Nine Fingers
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

It is only coincidental that I'm here to contradict Craig: I am rarely in my office on a weekend.

First, revisit the attributes of the mainframe file in detail. You need to look at two explicit data control block (DCB) attributes. LRECL is the logical record length, and BLKSIZE is the length of the block. I am guessing that 27840 is the block length, not the record length.

Unfortunately, I don't have much experience with CFF either, but the concepts are the same. When reading the mainframe file, you are depending on the DCB to manage your reads. If, for example, your copybooks indicate fixed record lengths for each record type, then you are not reading a variable length record. It could be as simple as that.

Good luck.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
pradkumar
Charter Member
Charter Member
Posts: 393
Joined: Wed Oct 18, 2006 1:09 pm

Post by pradkumar »

Merry Chrismas everyone.

I still have some problem on this one with an additional question:

I was told in Variable Block mainframe file, in the beginning of each record, there is a record prefix which indicates the actual length of the current record. So is DataStage able to read and understand the record prefix? If not, how does DataStage delimit the records in Variable Block file?

Any help would be Appreciated. Happy holidays!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If there is a length prefix, then it will be declared in the COBOL FD and, yes, if it exists DataStage can read it. However you may have to design in the "understanding" part, perhaps by specifying {prefix} in the record schema.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bobyon
Premium Member
Premium Member
Posts: 200
Joined: Tue Mar 02, 2004 10:25 am
Location: Salisbury, NC

Post by bobyon »

Unfortunately I've not used the CFF stage much either, but like Craig have quite a bit of experience with mainframe and variable lenght files.

My only contribution to the conversation at this point is to say that the 4 bytes at the beginning of the variable length record are not always apparent when viewing the file on the mainframe so don't be sure it is not there simply because you don't see it when looking at it on the mainframe. It depends on which tool you are using to display it,
Bob
Post Reply