View previous topic :: View next topic |
Author |
Message |
vlady Beginner
Joined: 17 Dec 2004 Posts: 8 Topics: 2
|
Posted: Thu Jul 28, 2005 7:51 pm Post subject: Cobol - FD statement on variable length input file |
|
|
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 |
|
 |
rasprasads Beginner
Joined: 10 Dec 2002 Posts: 59 Topics: 20 Location: Chennai
|
Posted: Thu Jul 28, 2005 9:05 pm Post subject: |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Jul 29, 2005 5:54 am Post subject: |
|
|
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 |
|
 |
vlady Beginner
Joined: 17 Dec 2004 Posts: 8 Topics: 2
|
Posted: Fri Jul 29, 2005 6:07 am Post subject: |
|
|
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 |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sat Jul 30, 2005 11:30 pm Post subject: |
|
|
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 |
|
 |
Bill Dennis Advanced

Joined: 03 Dec 2002 Posts: 579 Topics: 1 Location: Iowa, USA
|
Posted: Tue Aug 15, 2006 4:18 pm Post subject: |
|
|
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 |
|
 |
|
|