Make your own free website on Tripod.com


CREATING A DATA FILE FOR MICRO FOCUS COBOL

When a data file is created on a mainframe computer we don't have to worry about control characters and carriage returns.  If we specify an 80 byte record, that is what we get.  On a PC however things are different.  Most editors place special characters at the end of each line that are not normally visible except to the computer.  These characters tell the editor when an end-of-line is reached and when a carriage return is present. There are several methods to create a proper data file.

METHOD 1

The quickest way to create a data file is to use Notepad in windows. The biggest drawback is not having column and line position displayed.  If you are willing to carefully count the characters on your first line and place them according to the File Description you are given in the homework assignment then this method will work fine. Remember to use the space bar to enter the blank spaces at the end of the record if necessary before pressing return to begin the next record.  Then save the file as "a:\assgn3.dat" for example and you are done. You may want to load the file in Micro Focus and recount the spacing on one record to verify everything is correct.  Then print out the data file just as you would print your code so you can refer to the printout when debugging your program.  You can also use Wordpad but make sure to save your file as pure text.

METHOD 2

You may use the Character-Based compiler to create your data file from within Micro Focus Workbench.  I don't suggest you use this method because our tutorial emphasizes Graphical tools.  If you are familiar with the Character-Based compiler you may use the following steps:

1.  At the first screen after starting the program press "ALT + F8" and then "ALT + F5" to create a  new data file.
2.  Type the name of the file you want to create such as "a:/assgn3.dat" for example.
3.   Press tab to select line sequential and go to the next field.
4.   Leave the minimum field blank and enter your record length in the maximum field.  This value is obtained from adding all of the pic statements in your File Description together.  Look at the homework assignment to get the File Description. When you have typed in the number press "enter".
5.   At the new screen that appears you should see a label at the top that says something like "a:/assgn3.dat" (line sequential).
6.   Press F3 a couple of times to create space to work
7.   Enter each record of data, i.e. last name, first name, etc. including all the necessary spaces EXACTLY as indicated by the File Description.
8.  Make sure the line appears right after your last record and if not delete any blank lines with "F4".
9.  When finished entering records and eliminating any blanks at the bottom, save the file as usual (ALT + F4) and press "enter".
10.  Hit "escape" two times to return to the original Workbench Menu where you began.

METHOD 3

You may create your data file from within the Micro Focus Graphical compiler.  The detailed instructions are included in the Animator V2 Manual which you may download from this website.

CONCLUSION

I recommend you use the Micro Focus Animator V2 or Notepad to create your data file unless you are 100% certain that saving your file as ASCII text in WordPerfect or Microsoft Office 97 will result in no extra hidden characters that will cause errors when your program attempts to open your data file.

 

HOME

All pictures and material Copyright 1998 - 2004, A+ copyright Comptia, CCNA copyright Cisco Systems.  This page is optimized for Internet Explorer 6.0 at 800 x 600 resolution For problems or questions regarding this web contact [Webmaster]. Last updated: April 20, 2004.