COBOL FREQUENTLY ASKED QUESTIONS

Note:  The most recent questions appear last.  Also, even though some questions relate to assignments from previous terms the questions are dealing with problems that may occur any term and so all the information should be helpful.

Q:  I get an error message saying my directory space has run out.   Answer

Q:  Check doesn't seem to stop below an obvious error.  Answer

Q:  Check stopped on a name in the input file description and said it was invalid.  How can the name of something I am inputting be invalid?  Answer

Q:  When I try to change the spacing between my heading or detail line elements the spacing stays exactly the same.  Answer

Q:  In assignment 3 the instructions say to use the evaluate verb to test stu-status.  What is evaluate and how do I code it and where do I put it inside all my code to  make it work right? Answer

Q:  How do I create a data file?  Can't I just create it in WordPerfect? Answer

Q:  I don't know where to start on assignment 3.  Help!  Answer

Q:  When I run my program I get the message, " Read part record error: EOF before EOR or file open in wrong mode." Answer

Q:  I get a nestcall error when I run my program.  What is wrong?   Answer

Q:  I'm confused about how to print two reports with the same program.   Answer

Q:  How do I use COMM-CODE as a subscript when I don't see it anywhere.    Answer

Q:  I'm using the READ INTO verb to read my sorted file but where is the file being read into?  Answer

Q:  I'd like to use a Printer Spacing Chart but they don't sell them in the bookstore and I can't find them anywhere in town.  Where can I get one? Answer

Q:  The Animator V2 looks like it would be easier to use than the character based interface but I don't know where to start in using it.  Answer

Q:  I am having trouble downloading assignment 1a from Mr. Ustick's home page.  It is saying that it cannot open it in Media Player.   I copied the files in the computer lab previously, but my assignment 1 is not working, so I thought I might need to download something off the net.  Do you have any suggestions? Answer

Q: My column heading printed above my summary on the last page. How do I get rid of the column heading and just print the summary?  Answer

Q: How do I put a date in my heading in the form MM/DD/YY?  Answer

Q: Can I use another compiler such as the one by Fujitsu to do my assignments? Answer

Q:  My printout comes out on 3 pages for assignment 2 but you have everything posted as being on 2 pages. Answer

Q:  When I look at my display of our assignment 2 the names start at a Leigh Glover. I can not scroll any upwards any further. I have tried for several days everything I can think of to change my display. When I compile the program I do not get an error message, so I am pretty sure I have put in the commands correctlyAnswer

Answers:

Q:  I get an error message saying my directory space has run out.
A:  Make sure you have a floppy disk with sufficient space to hold the file you are editing or attempting to create. Try another newly formatted floppy disk if the error persists. Back to top

Q:  Check doesn't seem to stop below an obvious error.
A:  Make sure all the division names are spelled correctly including Working-Storage section. Note only one hyphen in that title.  When a division name is misspelled check may stop much further down the program and never highlight the misspelling.   The most common misspelling is ENVIRONMENT. Also, if you trace down one line of code that you know for certain is causing a problem but nothing seems misspelled or incorrect syntactically then delete the line and re-type it. Sometimes a hidden ASCII character can inadvertently get typed in and this will cause an error when checking. Back to top

Q:  Check stopped on a name in the input file description and said it was invalid.  How can the name of something I am inputting be invalid?
A:  The problem is probably in the Procedure division. Micro Focus can't find a reference to that File Description element in your program. Make sure the input FD elements are spelled correctly as well as the references in the Procedure Division. This problem can arise from a simple misspelling or if you are doing Extra credit problem 1 and modify the FD but not references to the FD elements later on in the Procedure division. Back to top

Q:  When I try to change the spacing between my heading or detail line elements the spacing stays exactly the same.
A:  Two common problems can cause this. For any change to take effect you must save the program and then re-check and animate (compile and run).  If you have done this then the second common error is putting spaces between columns when you are out of spaces in the line.  Take spaces out of the very end of the line and see if the heading or detail line spacing changes.  If so then I would suggest drawing the heading and/or detail line out on IBM Print Chart paper or common graphing paper and setting the heading and/or detail line up with proper spacing to fill the 80 or 132 columns that your output calls for. Drawing your headings and/or detail lines will allow you to easily see the character and filler spaces necessary to write pic statements. While writing the pic statements "on the fly" seems quicker, drawing them out on graph paper and writing pic statements could save you hours in the long run. Also, in industry a well documented program would require the output pages to be drawn out for reference in case the program needed modification. Back to top

Q:  In assignment 3 the instructions say to use the evaluate verb to test stu-status.  What is evaluate and how do I code it and where do I put it inside all my code to  make it work right?
A:  I have explained the  EVALUATE VERB  with extensive examples that everyone from beginner to experienced programmer can follow and immediately implement in their code. Back to top

Q: How do I create a data file?  Can't I just create it in WordPerfect?
A:  I have seen a number of people use WordPerfect and not save the file as an ASCII file which results in an unusable data file.  You should look at the data file for a previous assignment along with it's File Description and read the exhaustive instructions I have written on CREATING A DATA FILE before you create the file the wrong way and waste hours trying to figure out why your program won't run. Back to top

Q:   I don't know where to start on assignment 3
A:  I have prepared a GUIDE listing the steps I would take in approaching assignment 3 or any of the latter assignments. Back to top

Q: When I run my program I get the message, " Read part record error: EOF before EOR or file open in wrong mode."
A:  You must use the phrase "ORGANIZATION IS LINE SEQUENTIAL" in the select statement of the Environment Division for your data file.  See your first two sample programs or the text for proper placement of the phrase. Back to top

Q:  I get a nestcall error when I run my program.  What is wrong?
A:   If you are running a nested subprogram ( a subprogram within the file containing your main program) you need to set the compiler directive.  There are several ways of doing this. Your assignment instructions let you know a manual method of setting the directive. The is however; a way to hard code the directive.  At the very beginning of your program code the following line:

             Column  789
                           $SET NESTCALL
                             IDENTIFICATION DIVISION.
     The column numbers and identification division are there to give you a reference.  Starting in COLUMN 7 code $SET NESTCALL and the compiler directive will be set when you compile the program. Back to top

I'm confused about how to print two reports with the same program.
A:  If you are printing two different reports while each record is being processed such as an error report and regular good record report then you should use two different files.  This means where you have one select statement now in the Environment Division you need two along with and FD for each select statement. If you are printing one report while processing the records and then printing another report after the records are processed (such as traversing your wholesale price table to print all the entries) you only need one print-out. In this latter case if you think about what is physically happening all of the records have been processed and the report has been printed.  The second report doesn't require the records to be read again, it only requires the price table to be traversed and the entries printed out.  In this case you can use one print-out and both reports will be in the same file and you only need to print one file to print both reports. Back to top

How do I use COMM-CODE as a subscript when I don't see it anywhere.
A:  COMM-CODE appears in your copy file.  You might want to print a copy of the "cpy" file to aid you in debugging your program.  If COMMISSION redefined the commission table (your embedded table) then you would say COMMISSION(COMM-CODE) to access the proper entry. Back to top

I'm using the READ INTO verb to read my sorted file but where is the file being read into?
A:  You are reading into a file description that is specified by the copy statement and this copy file is read into your main program at the time of compilation. Back to top

I'd like to use a Printer Spacing Chart but they don't sell them in the bookstore and I can't find them anywhere in town.  Where can I get one?
A:  You can download a 132 COLUMN PRINTER SPACING CHART here by clicking on the  hyperlinked text.  I designed the chart in Microsoft Excel.  If you have Excel on your home system you can click on the file and it should open in Excel and allow you to print it; otherwise, you can print it out at the UWF Computer Lab. Back to top

Q:  The Animator V2 looks like it would be easier to use than the character based interface but I don't know where to start in using it.
A:  I have written a brief MANUAL which you can examine online or print.  The MANUAL takes you through common tasks in the Animator such as "Entering a program", "Compiling a program", "Beginning and advanced debugging options", and more. Back to top

Q:  I am having trouble downloading assignment 1a from Mr. Ustick's home page.  It is saying that it cannot open it in Media Player.   I copied the files in the computer lab previously, but my assignment 1 is not working, so I thought I might need to download something off the net.  Do you have any suggestions?
A:  It sounds like you tried to download the file to your home computer (which is fine) but your system has files with a "dat" extension associated with the media player you mentioned. You may have told the system to automatically open files of that type using the media player application or it may have done so by default.  In any case if you are using Netscape Navigator 4.0 or higher then to correct the problem do the following: Click "Edit", "Preferences", double click "Navigator", click "Applications", then find the media player and click on "edit".  Simply check the box that says "ask me before opening downloaded files of this type".  Then you will have the option to save or open the file. You always want to download it to the drive on your system where your assignment is located. The theory is the same if you are using Internet Explorer but of course the steps will be different.  Back to top

Q: My column heading printed above my summary on the last page. How do I get rid of the column heading and just print the summary?
A:  There are a couple of ways to solve this problem depending on where you want the summary to print and whether it needs it's own top of page. I have a section devoted to SUMMARY TIPS so this might help. Back to top

Q: How do I put a date in my heading in the form MM/DD/YY?
A:  I have a section devoted to DATES that you may want to read. Back to top

Q: Can I use another compiler such as the one by Fujitsu to do my assignments?
A: You can use any Cobol compiler that adheres to the ANSI 85 standards. UWF uses Micro Focus because it is one of the very best compilers enabling mainframe code to be developed on a PC. There are many Cobol compilers such as RM, Microsoft, Fujitsu, others on the marker. A student used the Fujitsu compiler, which also is a graphical compiler similar to Micro Focus Animator V2, in the past with no problems. The Fujitsu compiler plus documentation takes over 20 megabytes of space. You can follow this link to download the FUJITSU COMPILER.  I suggest downloading it to a zip disk from the UWF LAN due the universities higher speed Internet connection. If you are someone that is struggling to create folders and move files in Windows you probably are not a candidate to use this compiler. If; however, you are comfortable downloading and installing programs in Windows and you want to work at home but can't afford to buy the Micro Focus compiler then this demo compiler may help you. I have to give you one final word of caution.  I offer no support to help you install or debug specifically in the Fujitsu environment. At the beginning Cobol level you should have no problem compiling your code with either Micro Focus or Fujitsu.  Remember the source file is only an ASCII text file. You could therefore still bring your program in and recompile it on the LAN and produce and print your output with Micro Focus after developing your program at home with either Micro Focus or Fujitsu. Back to top

Q:  My printout comes out on 3 pages for assignment 2 but you have everything posted as being on 2 pages.
A:  Micro Focus lacks the versatility of a word-processing program in allowing you to easily do print previews and formatting of your output before printing.   Also, as in the case of assignment 2 it can be downright "buggy".   If you look at the assign2.out file in Micro Focus you can see some strange characters near the first page break.  These characters don't print but they let the printer know when to perform a page break.  Usually these work but sometimes the Animator has a problem sending the output properly to a network printer resulting in split printouts and wasted blank pages.  To solve this problem you can easily print your assignment 2 output in Wordpad, Notepad, and Microsoft Word 97.  To open the output file in Wordpad or Notepad click "Start",  "Programs", "Accessories", then Wordpad or Notepad.  Then after starting Wordpad or Notepad use "File" and "Open" to select the output file on your floppy disk and print it with "file" and "print" as is standard in Windows.  

For Word 97 (actually the easier method) simply click "start", "new office document " from the main menu bar", then select "blank document" and click "ok".  Then click "file" and "open" and select your assgn1.out file.  When you try to open the "out" file in Word you may get a conversion box that says the system has detected Unicode (UTF-8).  Click "ok" and let the document be converted.    You can delete any unnecessary page breaks and use "file" "print preview" to verify you have only two pages to print.  Then click "file" and "print" and "ok" in the network print box and you're done.  You can also save the "out" file with a "doc" extension so you can open and print the document in Word again. Back to top

Q:  When I look at my display of our assignment 2 the names start at a Leigh Glover. I can not scroll any upwards any further. I have tried for several days everything I can think of to change my display. When I compile the program I do not get an error message, so I am pretty sure I have put in the commands correctly.
A:  I ran your program and everything looked great.  I think your confusion lies in understanding the "Display" verb. If you examine the code the "Display" is placed near the end of the processing loop in the Procedure Division. "Display" sends the detail line (in this case) to the screen. Therefore, you can click the orange Animator icon on the bottom bar of the Animator screen and get a DOS screen. But remember what we see on the display screen is temporary. Your permanant data is sent to the file "a:\\assgn2.out". (or whatever path you are using)  The "Display" verb and display screen are aids to debugging and the "Display" was included so you could see it in action. You might need it later in your debugging arsenal (hint hint)

If you re-run your program you will find that by using "step" on the bottom bar of the Animator V2 window you can run each line of code one line at a time and when the "Display" is executed that single line will be written to the display screen. You will also see in the code where print out is written from the detail line. That code is where your permanent output file is written. Additionally concerning the display screen, you can not scroll up or clear the DOS Display window. I don't think that's a good design feature but that's how Micro Focus designed it.  You will find that quirk about the display screen covered in my Animator V2 manual which you can download.

At last you are ready to print your output which looks great by the way--good job. If you encounter a quirk where Micro Focus splits your output into 3 pages at a bizarre location (which it will for some inexplicable reason not related to your code) then you can print the output very simply in Word 97. I explain in detail how to print your output in Word in a previous question.  Back to top.

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.