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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COBOL TABLE LOOKUP QUESTION!

Status
Not open for further replies.

qshackelford

Programmer
Dec 11, 2013
2
US
I'm trying to use the policy number to code a table lookup to locate the name of the attending manager.

Policy Number
1001
1002
1003

Attending Manager
James Blankson
Jonne Gray
Charley Brocke

I really need help, thank you
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Are you talking about COBOL tables or relational database tables?
What is the format of the data in your table?


Nic
 
randy said:
I first used an if statement but that didn't work.

Show the IF statement. Why did it not work?

To do a table lookup, you first need to define the table. Have you done this?

Then, you would code a loop to look thru the table until a "hit" is found or the end of table is reached.
 
Do you know how to use the PERFORM .. VARIYING verb ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Pleas show us the code you have for your look-up and your table definition.


Nic
 
@randy - sorry about mis-quoting you earlier. If i could change my post i'd do so . . .
 
You will find that there are very few people who will help you, unless you show that you have made some genuine effort yourself.
I feel you are basically asking someone to give you the COBOL code that you need, without you really demonstrating that you even understanding the logic of the solution ( as opposed to how that logic would be implemented specifically using the COBOL programming language).

For example, you could have said something like :-
I want to create a working-storage table with 2 columns – POLICY-NUMBER as PIC X(04) and ATTENDING-MANAGER as PIC X(30).
I want the table to have 3 rows.
I want to put data ( as you have provided ) into the table.
I then want to be able to search the table for a particular POLICY-NUMBER and then display who the ATTENDING-MANAGER is, for that POLICY-NUMBER.

This would demonstrate that even if you don’t know how to do this in COBOL, that you have at least put in the effort to firstly figure out what you want the program to do.

It would have the added benefit of breaking down the problem into smaller chunks that can then be solved one at a time i.e. a ‘plan’.

There are probably very few people who will spend their time writing the code for you and just giving it to you. Most will just answer your question with another question ( frustrating – I know ). It’s hard, but in computer programming ( with a 3G language like COBOL ), you have to overcome lazy mindedness ( & no offence is intended in saying this ).

With regards to using tables in COBOL, you must become an expert on how to use them. I have found that most COBOL programmers don’t really understand them ( Tek-Tips contributors excluded, of course ).
If you don’t understand them, you will never be able to rest easy.
 
It seems that the OP is no longer interested in the answer. According to the description in his profile, he has logged into this forum only once.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top