Comments on: Remove hard coding AS/400 RPG Tue, 06 Oct 2015 05:07:12 +0000 hourly 1 By: philpl1jb Thu, 06 Aug 2009 21:03:43 +0000 #comment-66588 Yes. I don’t know where these people have been. You are spot on, you need a control file to contain the rules.

The rule name becomes the first field of the key, country code the second, the value third . for some fields you might have a value2 so you can enter a range, then for some fields you will need a text all of these fields are character.

So the AgeControl file
Key Country Value Description

In the processing programs you can load these into arrays and do a lookup or you can chain into the control file or you can get the values from the file to do a dynamic sql.

By: rpgking Thu, 06 Aug 2009 16:15:24 +0000 #comment-66566 JoBi, you seriously need to get some training or mentoring or complete your degree at IIT.

By: sloopy Fri, 31 Jul 2009 14:45:26 +0000 #comment-66326 I’m finding this a bit mysterious.

Why would you have a program that is selecting a set of records from one file, and a set of records from another file which has no connection at all?

As for the general case in which you have, for example, radically different processing requirements for data from different companies – usually this is done by checking the company first, and then calling programs specific to that country’s requirements. Otherwise you end up with a huge program that is almost impossible to maintain.

You see, once the requirements get beyond a certain level of complexity, it’s a losing battle to keep ONE program to do so may different things. And then someone adds a new country, and the whole thing is just spaghetti….


By: jobi Thu, 30 Jul 2009 02:50:39 +0000 #comment-66239 Hi Everyone,

Thanks for sharing your inputs.

The suggestions given are for example 1 field out of (let say) 10 fields from 1 file. What if I have more than 1 fields to be selected? Or other selections from other files? Do I need to define the fields and the file from the BDF as well?

For Example:
Field 1 = Age
Field 2 = Type
Field 3 = Salary Range

Filed 1.2. = Officer Code
Field 2 = Group

I’m reading file 1 and select age 15,16,17,18 and type 1,2,3,4. Read File 2 and select officer code xyz, abc, fgh.

How to define in DBF? And how to process?


By: sloopy Wed, 29 Jul 2009 14:35:21 +0000 #comment-66205 As Wilson suggests, it’s down to using files to store the information specific to the countries. So you would have a country file, and you would store the categories for each country in a country categories file, which would be keyed on country code – so your program load the category codes associated with the specific country, nad (as Phil suggests) you store those categories in an array and use it to look up the valid category code from the incoming data. If the incoming DB record has a country code that is not the one you are looking for, reject it anyway. If it has a category code that is not in the list you loaded, reject it.

This is all quite usual programming in most databases.


By: jobi Wed, 29 Jul 2009 02:57:46 +0000 #comment-66176 Hi Wilson,

Thanks for your reply.

Can you give example on how to go about it. My biggest problem is how to proceed after I have defined from the DBF.

For exampe, I need to select all records with category A,B,C,D. But I don’t want to hardcode A,B,C,D from my program because other countries may use different category code.

Then how do I define the selection from DBF if for example I have more than 1 selection criteria?

Please help.