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:
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
IF A <B1(1)
Move C(1) to output file
Move C(2) to output file
Move C(3) to output file
*****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.
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.