IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Need to declare variable file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
siva102

New User


Joined: 28 Nov 2007
Posts: 63
Location: Chennai

PostPosted: Thu Mar 19, 2009 4:44 pm
Reply with quote

Hi all,

i need to write a program where we dont know the LRECL of the input file.

So i declare the File secftion like below,

Code:
 FD  INPUT-FILE                                               
     RECORDING MODE V                                         
     RECORD VARYING 200 TO 7000 DEPENDING ON WS-RECORD-LENGTH
     BLOCK CONTAINS 0 RECORDS                                 
     LABEL RECORDS ARE STANDARD.                             
 01 INP-RECORD                           PIC X(7000). 


I passed the lrecl of the input file through linkage section so that before opening the file
Code:
WS-RECORD-LENGTH = 3000


and for testing purpose i run a job whose LRECL = 3000.

But the job abend because of file mismatch error.

So can anyone please let me know how to declare for FD in FILE SECTION for variable input file length.
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Thu Mar 19, 2009 5:14 pm
Reply with quote

Can you please post the error that you are getting
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 19, 2009 5:31 pm
Reply with quote

The LRECL of the data set being referenced as INPUT-FILE must be 7004 bytes, 7000 for the record and 4 bytes for the RDW (Record Descriptor Word). If your file LRECL is not 7004 that would explain the file mis-match error.
Back to top
View user's profile Send private message
siva102

New User


Joined: 28 Nov 2007
Posts: 63
Location: Chennai

PostPosted: Thu Mar 19, 2009 6:25 pm
Reply with quote

Hi,

Actully I am writting a common module for most of the input file which are of different Lrecl.

Let's say 200, 2300, 6900

So hw to declare the FD section such that when the lrecl of 200 file was given as input at that time the Input-record in Cobol should contain 200 characters similarly for the rest.

This is the error that i got ,

Code:

A file attribute mismatch was detected. File INPUT-FILE in program ***** was
and the file specified in the ASSIGN clause did not contain the same attribute.
A file attribute mismatch was detected. File INPUT-FILE in program ***** had
the file specified in the ASSIGN clause had a record length of 3000.           


is there any technique that can be used to do my requirement.
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Thu Mar 19, 2009 6:34 pm
Reply with quote

Your LRECL in jcl should have 7004 bytes with RECFM VB. And all the input files should also have the same LRECL and RECFM as VB, but the length of the records in the file can be from 200 - 7000 as mentioned.

Can you please post the JCL and also the attributes of the input files.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Mar 19, 2009 7:18 pm
Reply with quote

Not only has this topic been discussed multiple times here, session 8237 at Share in Austin had a detailed description of what is needed.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Mar 19, 2009 7:26 pm
Reply with quote

Wasn't this talked about already in this topic - COBOL program for unknown Input file length.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Mar 19, 2009 7:50 pm
Reply with quote

Why would somebody think that many FB files of different length is the same as one VB file?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top