View previous topic :: View next topic
|
Author |
Message |
aneeta
New User
Joined: 08 Dec 2005 Posts: 48 Location: Chennai
|
|
|
|
I have files as below and need to compare their values. I need to use the arithmetic operators like <,<=,>,>=,= present in one of the input files in the cobol code for comparing 2 fields. Is it possible to handle?
Input file 1:
A
-442.2
2089.00
-2700.00
Input file 2:
B B1 C
< 1000 1
>= 1000 2
> 1000 3
****B contains <,>=,> and B1 contains 1000 and C contains 1,2,3
I'm loading the file 2 into a table for searching the values
Cobol check:
IF A <B1(1)
Move C(1) to output file
ELSE
IF A>=B1(2)
Move C(2) to output file
ELSE
IF A>B1(3)
Move C(3) to output file
END-IF
END-IF
END-IF
*****I need to know if I can use Column B directly in the code instead of hardcoding <,>,etc in the cobol code. This is because the conditions are bound to change by the users any time and they want a dynamic code. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Firstly, find out how to use the Code tags. You've been here a long time, and made 45 posts, so should have got it by now.
Also, have a look at the surprising number of recent questions on this sort of topic.
The answer is No.
One handy thing about compiled code is that you just can't change it willy-nilly as you go along at run-time. Means you stand a chance of testing and getting reliable results. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
For your limited example it is not difficult to code to treat this as a "dynamic" thing anyway. Bear in mind that although it is not difficult, it has to be correct, understandable and maintainable.
Someone has to be responsible for changing the data, and changing it correctly, when needed. You need to programmatically verify the data before it can be used (you have an "elseless" example, so, for instance, need to ensure that the conditions do not leave anything to "else"). You need a full audit-trail of changes. You need to take this file into account for re-runs and things like that.
If you are looking to apply this to your whole system so there don't have to be any more program changes, look through the other recent topics and see what you are facing. |
|
Back to top |
|
|
|