MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cobol - FD statement on variable length input file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vlady
Beginner


Joined: 17 Dec 2004
Posts: 8
Topics: 2

PostPosted: Thu Jul 28, 2005 7:51 pm    Post subject: Cobol - FD statement on variable length input file Reply with quote

There is a file that I need to use as my input file but it was created with LRECL=0, BLKSIZE=27998.

My program bombs on the open of the file with the following messages:
An error occurred when opening or closing a file.
An attempt to OPEN or CLOSE file TESTIN failed.
DDNAME: TESTIN
RECFM: VB
LRECL: 27998
BLKSIZE: 27998
Variable records - Blocksize-4 not a multiple of LRECL

Below is my FD statement:
FD TESTIN-FILE
LABEL RECORDS ARE STANDARD
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
RECORD IS VARYING
FROM 100 TO 27994 CHARACTERS.
01 TESTIN-RECORD PIC X(27994).

How do I need to define the FD statement to make this work since the LRECL is actually zero on the input file?

Any help would be appreciated.
Back to top
View user's profile Send private message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Thu Jul 28, 2005 9:05 pm    Post subject: Reply with quote

Probably you should have given 27990 instead of 27994 in the FD section.

"In Recording Mode V (Variable)
Blocks can contain more than one record. Each data record includes a record- length field and each block includes a block-descriptor field.They are each 4 bytes long..."
_________________
Rasprasad S
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Jul 29, 2005 5:54 am    Post subject: Reply with quote

Quote:

There is a file that I need to use as my input file but it was created with LRECL=0, BLKSIZE=27998.

My program bombs on the open of the file with the following messages:
An error occurred when opening or closing a file.
An attempt to OPEN or CLOSE file TESTIN failed.
DDNAME: TESTIN
RECFM: VB
LRECL: 27998
BLKSIZE: 27998


vlady,

You statements are contradictory. How was the file created with LRECL of 27998 when you created it by coding lrecl=0. ?[

Your vb file should be created with LRECL=27994 and BLKSIZE=27998 to match your FD statements.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vlady
Beginner


Joined: 17 Dec 2004
Posts: 8
Topics: 2

PostPosted: Fri Jul 29, 2005 6:07 am    Post subject: Reply with quote

Oh, I didn't create the file, it already exist, I'm just trying to read it. Maybe I'm stupid but I've just never seen a file created with the LRECL of zero.

Thanks for the suggestion, I'll try that.
Back to top
View user's profile Send private message
slade
Intermediate


Joined: 07 Feb 2003
Posts: 266
Topics: 1
Location: Edison, NJ USA

PostPosted: Sat Jul 30, 2005 11:30 pm    Post subject: Reply with quote

I think the 1st thing you might want to try is to run LISTCAT against the file to determine its true attributes. The max LRECL s/b at least 4 bytes less than the BLKSIZE.

Once you know that you can better determine an approach for your pgm.
_________________
Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Tue Aug 15, 2006 4:18 pm    Post subject: Reply with quote

Added for clarification:
Unless the file is VSAM, you won't get any LRECL info out of a LISTCAT.

For DASD files, display via ISPF or use PGM=IEHLIST LISTVTOC.

For tape files, check your tape management system or dump the HDR labels on standard label tapes.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group