Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Need to declare variable file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
siva102

New User


Joined: 28 Nov 2007
Posts: 64
Location: Chennai

PostPosted: Thu Mar 19, 2009 4:44 pm    Post subject: Need to declare variable file
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    Post subject:
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: 8051
Location: East Dubuque, Illinois, USA

PostPosted: Thu Mar 19, 2009 5:31 pm    Post subject:
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: 64
Location: Chennai

PostPosted: Thu Mar 19, 2009 6:25 pm    Post subject:
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    Post subject:
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: 8051
Location: East Dubuque, Illinois, USA

PostPosted: Thu Mar 19, 2009 7:18 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Thu Mar 19, 2009 7:26 pm    Post subject: Reply to: Need to declare variable file
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: 1228
Location: Israel

PostPosted: Thu Mar 19, 2009 7:50 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us