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

Configurable Parameter file in Cobol Program

Status
Not open for further replies.

shaily123

Programmer
Feb 5, 2005
17
US
Hi, I have a Cobol program that reads values from a sequential file. So that if the values change we do not have to release the code again, just a data file change with new values. The problem i am getting to make operators configurable.

for example: I have one If statement like

IF DRUG_DOSAGE > 50 so in this case i can read 50 from the sequential data file. but this condition can change to "IF DURG_DOSAGE < 50" in this case i need to change the code as operator is changed.

So my question is : Is there a way I can make operators also configurable in my program via data file.

The operators can only be >, <, >=, <=, =

 
I think that we few more clues, such as what "values change" might mean. The normal case would be testing some numeric, or alphanumeric, value. But I gather this is more complex. I just don't know without seeing some of the sample input, with a more thorough explanation of the business rule you are trying to code.

Tom Morrison
Hill Country Software
 
If you are using SQL to "read" the data, such as with Oracle's Pro*COBOL, then you can dynamically build the read statement, which is actually a SQL query. So, you can build the WHERE clause on the fly. I don't think you can do this within ordinary COBOL, but perhaps with a call to an external sort program, like Syncsort.

==================================
adaptive uber info galaxies (bigger, better, faster, and more adept than cognitive innovative agile big data clouds)


 
@ K5tm - For example I have business rules like
if dosage_amt > 50 then dosage_no = 0 otherwise 1
if Frequency <= 3 then frequency_no = 0 otherwise 1
if dosage_type = 'active' then dosage_type_no = 1 otherwise 0
if patient_age >= 45 then patient_no = otherwise 0

I need to write a program where when the rules change we do not need to modify the code. So i thought of making a parameter file. The program read the records from the file for all compare values. But the issue is now business is saying we can change the conditions like below.Here I have values in my file so if they change no issue but how should i handle the operators externally with out changing the program.

if dosage_amt < 90 then dosage_no = 0 otherwise 1
if Frequency < 6 then frequency_no = 0 otherwise 1
if dosage_type = 'active' then dosage_type_no = 1 otherwise 0
if patient_age = 55 then patient_no = otherwise 0
 
@ johnherman- Thanks for your reply, i am not using SQL or PRO* COBOL.
 
I would be helpful to know which COBOL you are using...

Tom Morrison
Hill Country Software
 
Following shaily123's line of thought, you could have a long series of IF/THEN/ELSE statements to gather various conditions for reading rows or aggregating data based on the parameter control file.

==================================
adaptive uber info galaxies (bigger, better, faster, and more adept than cognitive innovative agile big data clouds)


 
How many data element names (such as dosage_amt, frequency, dosage_type, patient_age, etc) are going to be in your 'dictionary' of known data elements?

How extensive is your list of operators.

Is the result of a test always setting a single data element to one of two literal values?

If the number of data element names is small, then you should be able to read/parse your rules (into a table, if you are going to apply the rules to a large number of RX at one time), and use an EVALUATE to produce COBOL code that is maintainable and readable. (Please, oh please, do not use a long series of IF-then-else.)

If the dictionary of data elements is large...that's not in the realm of free advice! [pipe]

Tom Morrison
Hill Country Software
 
Thanks Guys for the reply. I am definitely not using long list of If-Then-else...
After thinking I got a way to do this. I will be using low and high fields into my parameter table for each numeric variable.
So when the rules change I can modify the parameter table with all low and high value. That will allow not changing the program just the parameter table.
 
So it sounds like you have a plan.

Sometimes just 'talking it out' helps clarify the problem. I know that often works for me.

Tom Morrison
Hill Country Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top