| Type | Description | How to fix some common Errors |
|---|---|---|
| Pre-compiler | Problems that prevent the job from being submitted to the complier, usually bad JCL | |
| Compiler | Problems with your COBOL code | |
| Run-time | Your program complied and ran, but did something illegal | Methods for fixing run-time errors |
| 3 Types of Errors | ||
This is normally caused by extra numbers the editor adds to your program. They are not immediately visible to you when type in your program. They are to the left of what you type. To see them (and it is good idea to see if they are there before you start typing your program), press F10 in the editor to see what is left of the screen. Press F11 to go back to the right.
SOLUTION:
Your screen will look like this when hit F10, if you have the double numbering problem.
000100 000100LERR JOB NO1NOZIT,'DANIEL C',CLASS=K,MSGCLASS=C,
000200 000200TIFY=LOGONID,USER=RACFUSER,PASSWORD=RACFPASS
000300 000300E PRINT R15
000400 000400EC COBV2CLG,PARM.COB2=('LIB,NOSEQ,ADV')
000500 000500.SYSIN DD *
000600 000600 IDENTIFICATION DIVISION.
000700 000700 PROGRAM-ID. EXMPL1.
|
--------------------------------- Input Jobs ---------------------------------- -------JOBNAME--JOBID--ACT-STA-OWNER----C-POSIT-PRTY-SECLABEL-QUALIFIER-------- _ 1 SAMPLERR J00836 JOB BZ5112 1 9 |
Your problem is that you added a space in the JCL at the beginning of your program. For example, there is an extra space midway through the first line of code after the comma and before 'DANIEL C'. This causes the computer to ignore the rest of the line (which has important information about when your program will run). JCL is very picky. Do not add any extra spaces.
000001 //SAMPLERR JOB NO1NOZIT, 'DANIEL C',CLASS=K,MSGCLASS=C, 000002 // NOTIFY=LOGONID,USER=RACFUSER,PASSWORD=RACFPASS |
--JOBNAME---JOBID--STATUS---RAN/RECEIVED----DAY--------DEST-------------------- SAMPLERR J00952 OUTPUT 12:45 1/26/99 TODAY UOKMVSA ******************> Job Terminated Prior to JCL Conversion <******************* |
SOLUTIONRemove the extra space or add a space where it is missing. You can use the JCL in the example program as a guide. In the program below, the extra space after the comma and before USER caused the above error.
000001 //SAMPLERR JOB NO1NOZIT,'DANIEL C',CLASS=K,MSGCLASS=C, 000002 // NOTIFY=LOGONID, USER=RACFUSER,PASSWORD=RACFPASS |
This error message is generated at least one line after you left out a period. Notice that in the example below, a period was left out in line 1, but the error came after line 2.
SOLUTION: Add the period. Int the example below, add a period after DIVISION.
000001 IDENTIFICATION DIVISION 000002 PROGRAM-ID. EXMPL1. ==000002==> IGYDS1082-E A period was required. A period was assumed before "PROGRAM-ID". |
The number of characters you assign the file in the RECORD CONTAINS clause must match the total of all the picture clauses in the record that is associated with the file. In the example below, the associated record has 80 characters, but the RECORD CONTAINS clause says 79.
SOLUTION: Change the RECORD CONTAINS clause to the right number. In the example below, change 79 to 80.
==000018==> IGYGR1180-E The integer in the "RECORD CONTAINS" clause for file "EXAMPLE-IN" was
less than the maximum calculated record size 80. "RECORD CONTAINS 80"
was assumed.
000019 RECORD CONTAINS 79 CHARACTERS
000020 BLOCK CONTAINS 0 RECORDS
000021 DATA RECORD IS EXAMPLE-RECORD.
|
SOLUTION: Always use an implied decimal point (v) for reading in numbers.
000029 03 EXAMPLE-HOURS-ATTEMPTED PIC 9(3).99. 000030 03 EXAMPLE-HOURS-ATTEMPTED-X |
The value given in a VALUE clause must be less than or equal to the length given in the PIC clause. Below, the PIC caluse for the FILLER specifies a length of one (X), but the VALUE is two characters long (--).
SOLUTION: Either increase the length of the PIC clause or remove characters from the VALUE clause. In the example below, change the PIC X to PIC XX OR change the VALUE '--' to VALUE '-'. This way, both the PIC and VALUE have a length of one.
000052 05 PRT-ID-1 PIC X(03).
000053 05 FILLER PIC X VALUE '--'.
==000053==> IGYGR1056-E "VALUE" literal "'--'" exceeded the length specified in the "PICTURE"
definition. The literal was truncated to the "PICTURE" definition
length.
|
You will get strange error messages if you forget a dash in a paragraph or other identifier name, especially if some of the words in your paragraph are COBOL words. In the example below, the computer sees OPEN as a separate statement instead of part of a paragraph name. It cannot understand why you are issuing a perform and open command on the same line, so you get errors that don't tell you the real problem, which is the dash missing between OPEN and FILE.
SOLUTION: Correct the procedure name. Below, add a dash between OPEN and FILE to make the true procedure name, OPEN-FILE-ROUTINE.
000072 PERFORM OPEN FILE-ROUTINE.
==000072==> IGYPS2098-S An "OPEN" statement was found without "INPUT", "OUTPUT", "I-O" or
"EXTEND". The statement was discarded.
==000072==> IGYPS2112-E The "PERFORM" verb did not have a matching scope terminator. A scope
terminator was inserted on line 72. The execution results may not be
correct.
|
This means that either you forget to define EXAMPL-ID-1 in the WORKING STORAGE section, or that you defined it there and spelling it differently in the procedure division. Identifiers must appear exactly as you typed them in WORKING STORAGE. The compiler has no spell-checker or other way to know what you mean if you type the wrong name.
SOLUTION: Correct the name in either working storage or in the procedure division so the two names match exactly. It is usually better to change the identifier in the procedure division (i.e., where the error shows up) because changing the name in working storage may cause the identifier definition not to match up with other uses in the procedure divison. In the example below, add an E to the end of EXAMPL so that it matches the definition in working storage, which was:
000023 01 EXAMPLE-RECORD. 000024 03 EXAMPLE-STUDENT-ID. 000025 05 EXAMPLE-ID-1 PIC X(03). 000026 05 EXAMPLE-ID-2 PIC XX. |
000135 MOVE EXAMPL-ID-1 TO PRT-ID-1.
==000135==> IGYPS2121-S "EXAMPL-ID-1" was not defined as a data-name. The statement was
discarded.
|
No "SELECT" statement was specified...
The name given for the SELECT statement, the internal file name, must match exactly the name in the corresponding file description (FD) statement.
SOLUTION: Change the names to match exactly. In the example below, change SELECT EXAMPLEIN to SELECT EXAMPLE-IN.
000010 FILE-CONTROL.
000011 SELECT EXAMPLE-PRINT ASSIGN TO PRTFIL.
000012 SELECT EXAMPLEIN ASSIGN TO STUDNT.
==000012==> IGYGR1131-S Neither an "FD" nor an "SD" was found in this program for file
"EXAMPLEIN". The clause was discarded.
000013
000014 DATA DIVISION.
000015
000016 FILE SECTION.
000017
000018 FD EXAMPLE-IN
==000018==> IGYGR1232-S No "SELECT" statement was specified for file "EXAMPLE-IN". The file
definition was discarded.
|
Identifiers with "children" can not have a picture clause. (see record description). Their PIC is implied by that of their children.
SOLUTION: Remove the PIC clause. In the example below, remove PIC X(8) from line 51 so that the line reads 03 PRT-STUDENT-ID.
000049 01 WS-PRINT-RECORD.
000050 03 FILLER PIC X VALUE SPACE.
000051 03 PRT-STUDENT-ID PIC X(8).
==000051==> IGYDS1052-E Group item "PRT-STUDENT-ID" contained the "PICTURE" clause. The clause
was discarded.
000052 05 PRT-ID-1 PIC X(03).
000053 05 FILLER PIC X VALUE '-'.
000054 05 PRT-ID-2 PIC X(02).
000055 05 FILLER PIC X VALUE '-'.
000056 05 PRT-ID-3 PIC X(04).
|
Characters such as * + = / and - when used as the minus sign must have spaces before and after them.
SOLUTIONAdd spaces before and after these characters.
000372 PERFORM PROCESS-SUBTOTAL-LOOP
000373 UNTIL CLASS-CODE NOT= HOLD-CLASS-CODE
==000373==> IGYPS0001-W A blank was missing before character "=" in column 36. A blank was
assumed.
|
Unlike compiler errors, the computer will not tell you what line of code caused the error. You must determine what caused your program to die. To do this :
DISPLAY 'ABOUT TO OPEN FILES'. PERFORM OPEN-FILE-ROUTINE. DISPLAY 'FILES HAVE BEEN OPENED'.If the last line in the SYSOUZ file is ABOUT TO OPEN FILES, then you know the problem is somewhere in the OPEN-FILE-ROUTINE.
--JOBNAME---JOBID--STATUS---RAN/RECEIVED----DAY--------DEST--------------------
SAMPLERR J01616 OUTPUT 13:02 2/04/99 TODAY ADAMS
--RC--PGM--------STEP-----PRSTEP---PROC-----COMMENTS---------------------------
0 IGYCRCTL COB2 COBV2CLG
0 IEWL LKED COBV2CLG
ABND COBV2CLG GO COBV2CLG ABEND SYSTEM=000 USER=1037
|
| ABEND Display in IOF |
Please select one of the errors from the pull-down menu.
You selecetd an invalid option.