Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input file Checking

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Greetings again, thank you very much for help in my last question, alas, I have another.


Is there anyway to check to make sure the records coming in off the input file are a certain length?

and if they aren't to either truncate or exclude them and move one?

I can not change the input file and the program gives me a logic error in saying the file never opened, I think it is because of that, it sees the error and dosn't know what to do, is there a way around this?

Thank you
Dash
 
What compiler/OS/version are you using? What is the layout of the file (e.g. MVS VSAM VB, ASCII with linefeeds delimiting records, etc)?

Beyond the use of OCCURS DEPENDING ON and/or use of a common area to identify the type of record (an therefore the length), there are no "standard" ways of figuring out the record length that I am aware of. Each OS/compiler combination provides features that may or may not be helpful.

You note that the problem you're actually seeing is that the file is not open. Do you have FILE STATUS coded for the file? If not, you should do so and check its value after the (attempted) OPEN to see what error, if any, is returned. That will often provide a definitive answer to the problem.

Good luck.

Glenn
Brainbench MVP for COBOL II
 
Hey Dash,

First, show us how you SELECTed the file; then maybe you can show us also your FD file definitions with the record descriptions... and we 'll go from there.
 
On our mainframe the default recording mode is "F" for fixed length records. For a variable length record you have to tell the compiler "RECORDING MODE IS V" or something like that to indicate that the record size varies. SAM variable length records have control fields to indicate the record length.

A lot depends on the type of files you are using, what operating system/file system you are using, and the compiler. On a PC you might handle it differently, or use a comma seperated file, like VB uses. If you do not like my post feel free to point out your opinion or my errors.
 
Hey Dash,

Not nice to present an ill defined problem then disappear when clarifications are requested. Other culprits please note!

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top