Page 1 of 1

How to read a record from n no of records in a file.

PostPosted: Fri Nov 18, 2011 2:40 pm
by shanshar
Suppose i have one file having number of records..for ex..

ABC = 12
BCD = 24
EFG = 3
FGH = 44
GHI = 5
IJK = 67
JKL = 79
...
...
NNN = 999

Now i have to search the value of "GHI" from this file. if its find it will dispaly the value "5" else will display no record found.

My querry is how to code this in cobol.
PLeaes let me know the code as am new to cobol dont have an idea to achieve this.

Re: How to read a record from n no of records in a file.

PostPosted: Fri Nov 18, 2011 2:45 pm
by enrico-sorichetti
looks that You have also issues with the logic !
start writing the pseudo code in plain words and then worry about the COBOL part

here is a very good link with lots of examples clearly explained
http://www.simotime.com


Pleaes let me know the code as am new to cobol dont have an idea to achieve this.


this is a help forum, not a do it for me one... :evil:
if You do not have the slightest idea on how to do it
then the training institute You are attending sucks, You are just wasting time and money

Re: How to read a record from n no of records in a file.

PostPosted: Sat Nov 19, 2011 11:05 am
by dick scherrer
Hello,

PLeaes let me know the code as am new to cobol dont have an idea to achieve this.shanshar

We will help you with your classwork, but we will not do the work for you. . .

If you are stuck on how to aproach this, suggest you take a few bits of paper and write the contents of on record on each bit of paper. Stack them and voila - you have your input file. Now, think about what tyou need to do to get to the desired result. As Enrico suggested, consider pseudo-code to work thru the mechanics. Once you can do this "by hand", incorporate it into COBOL code.

If you get stuck coding, post what you have tried and your doubt. Someone should be able to clarify.

It is our goal to help you learn and the more we do, the less you learn.