INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

Configurable Parameter file in Cobol Program

Configurable Parameter file in Cobol Program

(OP)
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 >, <, >=, <=, =

RE: Configurable Parameter file in Cobol Program

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

RE: Configurable Parameter file in Cobol Program

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)


RE: Configurable Parameter file in Cobol Program

(OP)
@ 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

RE: Configurable Parameter file in Cobol Program

(OP)
@ johnherman- Thanks for your reply, i am not using SQL or PRO* COBOL.

RE: Configurable Parameter file in Cobol Program

I would be helpful to know which COBOL you are using...

Tom Morrison
Hill Country Software

RE: Configurable Parameter file in Cobol Program

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)


RE: Configurable Parameter file in Cobol Program

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

RE: Configurable Parameter file in Cobol Program

(OP)
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.

RE: Configurable Parameter file in Cobol Program

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close