How to Write a Simple Easytrieve Programby eHow Computers Editor
Easytrieve is a programming language that helps you retrieve data from databases that you work with. It is an easier language to learn than COBOL or FORTRAN. However, when you are working with databases that are public they are usually time sensitive so you need to get in and out as quickly as possible. The following will give you the basics of how to write a simple Easytrieve program.
Understand what you need. Make sure you understand the scope of the job. The simplest way to extract data is not to limit what you draw, but cut it down later. See tips to find out why. Working with an out file is much easier and not time sensitive.
Make sure you designate the database that you want to capture the data from. Easytrieve needs to know where you need to go in order to get there. When you program you are creating a map and you can't leave out any steps or you certainly won't end up where you want to be.
Retrieve a copy of the layout of the database you are using. You need to know where each of the variables resides in order to know where they are when you are working with the database or outfile that you created.
Create an outfile in your program. This will be the place where you send your results. Usually this file will be saved to your own pc and therefore you will have unlimited access to it and not have to worry about any time sensitivity the database has.
Run the program. If there are any mistakes you will need to fix them. These could range from not indicating the database you are seeking correctly to simply wording a step incorrectly. You need to correct your mistakes and run the Easytrieve program again until you get the results you are seeking.
Select the variables you need using your outfield. If your instructions only ask for data for June 2005 you need to indicate it in your program. You may also need to only capture males or females of a certain age. Whatever the limitations are you want to add them in your program before you go any farther.
Add any variables that do not exist. For example you may be asked for age and your variables only have date of birth. Therefore you would need to create two variables; one for the current date and one subtracting the date of birth from the current date variable to get the age of the person. Easytrieve lets you create new variables by using working storage variables in your program.
Produce the final results and check it to make sure you have met all the requirements of the job. Give them to the appropriate person. This could be your customer or your supervisor.
- check Customers are notorious for changing their mind and coming back and asking for more data later. Therefore, if you have already captured the data it is a simple task to add more to the finish product.