COBOL ON MVS

非原创,网上摘录

A STUDENT APPROACH TO
COBOL ON AN IBM MVS/XA OPERATING SYSTEM








In this handout we follow step-by-step instructions in creating
a COBOL program. Job Control Language (JCL) is used to demonstrate
file linkage as well as program execution. For the purpose of this
handout, we assume you have successfully accessed the ISPF/PDF
PRIMARY OPTION MENU shown below:

GEORGIA STATE UNIVERSITY COMPUTER CENTER
--------------------ISPF/PDF PRIMARY OPTION MENU-----------------------
OPTION ===>
USER ID -userid
0 ISPF PARAMS -Specify terminal and user parameters TIME -14:42
1 BROWSE -Display source data or output listing TERMINAL -3278
2 EDIT -Create or change source data PF KEYS -24
3 UTILITIES -Perform utility functions
4 FOREGROUND -Invoke language procedures in foreground
5 BATCH -Submit job for language processing
6 COMMAND -Enter TSO command or CLIST
7 DIALOG TEST -Perform dialog testing
8 LM UTILITIES-Perform library management utility functions
C CHANGE -Display summary of changes for this release
T TUTORIAL -Display information about ISPF/PDF
X EXIT -Terminate ISPF using log and list defaults

Enter END command or PF3 to terminate ISPF.



SECTION ONE: Creating your COBOL program.


1.1) Enter 6 at the "OPTION ===>" prompt of the ISPF/PDF PRIMARY OPTION
MENU, and press return to go to TSO COMMAND PROCESSOR panel.

1.2) Type CREATE at the cursor, and press return. Next, type your initial
when you are asked to "ENTER LIBRARY/APPLICATION NAME ===>". Press
return, and type COBOL at the next prompt. Press return one more
time when you see three asterisks displayed (press return anytime
you see *** displayed).

1.3) Use the F4 key to go back to the primary menu. Then, enter 2 at
the "OPTION ===>" prompt to go to the EDIT - ENTRY PANEL.
Fill the sections of this panel as shown below:


------------------------- EDIT - ENTRY PANEL ---------------------------
COMMAND ===>

ISPF LIBRARY:
PROJECT ===> your userid
GROUP ===> your initials ===> ===> ===>
TYPE ===> COBOL
MEMBER ===> program name (Blank for member selection list)

OTHER PARTITIONED OR SEQUENTIAL DATA SET:
DATA SET NAME ===>
VOLUME SERIAL ===> (If not catalogued)

DATA SET PASSWORD ===> (If password protected)

PROFILE NAME ===> (Blank defaults to data set type)


Press return and you will see an empty file as shown below:


EDIT --- User-id.Initial.COBOL(member) ------------- COLUMNS 001 072
COMMAND ===> SCROLL ===>PAGE
****** *********************** TOP OF DATA **************************
''''''
''''''
''''''
''''''
''''''
''''''
.
.


Type UNNUM at the cursor and press return. Press the TAB key twice,
type the letter "I" (insert), and press return. Tab back then type
COLS and press return. Use the right arrow key to move the cursor
to the right. The first line of the body of a COBOL program will
start in column 8. The first line in the body of the COBOL program
will be the IDENTIFICATION DIVISION.


EDIT --- User-id.Initial.COBOL(member) ------------- COLUMNS 001 072
COMMAND ===> SCROLL ===>PAGE
****** ********************** TOP OF DATA ***************************
=COLS>----+----1----+----2----+----3----+----4----+----5----+----6----+
''''''
****** *********************BOTTOM OF DATA **************************

Press return followed by the HOME key. This will take your cursor
back to the COMMAND line. Type the command RES which stands for
RESEQUENCE. This will cause the rulers to disappear.
Upon entering successive lines of text, the cursor will be placed
under the first non-blank character of the previous line. Since
many of the lines of COBOL start in either column 8 or 12, this
is most convenient. You don't need to use the cursor keys or
space key near as much when entering successive lines of text.

After typing your program you should press the home key and type
the word SAVE on the COMMAND line. You may type CANCEL on the COMMAND
line to leave the EDIT screen without saving your program or changes
that you made to an existing program. The SAVE command may be used
as an extra precaution in saving text to disk. It is, however, not
necessary. The very act of moving from one ISPF/PDF panel to the
next will automatically SAVE your text to disk when exiting the
Editor.

In writing the File Description (FD) sections of your COBOL
program, there are certain conventions that must be followed
when interfacing with the IBM operating system. The FD phrase
'BLOCK CONTAINS 0 CHARACTERS' allows record and block size to be
controlled by the Dataset Definition (DD) statements in the
JCL rather than the COBOL program.
Use the example below to help you with your own program.

EDIT --- user-id.init.COBOL(TEST1) - 01.01 --------- COLUMNS 001 072
COMMAND ===> SCROLL ===>PAGE
****** ******************** TOP OF DATA **************************
000001//STEP0 EXEC WORKFILE,DSN=OUTFILE,LRECL=133,BLKSIZE=13300,
000002// RECFM=FBA
000003//STEP1 EXEC COBUCLG,PARM='LANGLVL(2),APOST'
000004 IDENTIFICATION DIVISION.
000005 PROGRAM-ID. TINY-PROGRAM.
000006 AUTHOR. GORDON HOWELL.
000007
000008 ENVIRONMENT DIVISION.
000009 CONFIGURATION SECTION.
000000 SOURCE-COMPUTER. IBM-370.
000011 OBJECT-COMPUTER. IBM-370.
000012 INPUT-OUTPUT SECTION.
000013 FILE-CONTROL.
000014 SELECT INPUT-FILE ASSIGN TO UT-S-INFILE.
000015 SELECT OUTPUT-FILE ASSIGN TO UT-S-OUTFIL.
000016
000017 DATA DIVISION.
000018 FILE SECTION.
000019
000020 FD INPUT-FILE LABEL RECORDS ARE OMITTED
000021 BLOCK CONTAINS 0 CHARACTERS.
000022 01 INPUT-RECORD PIC X(80).
000023
000024 FD OUTPUT-FILE LABEL RECORDS ARE OMITTED
000025 BLOCK CONTAINS 0 CHARACTERS.
000026 01 PRINT-LINE PIC X(132).
000027
000028 WORKING-STORAGE SECTION.
000029 01 END-OF-FILE-SWITCH PIC X(3).
000030
000031 PROCEDURE DIVISION.
000032
000033 000-MAINLINE-DRIVER.
000034 PERFORM 100-INITIALIZE.
000035 PERFORM 200-PROCESS-DATA
000036 UNTIL END-OF-FILE-SWITCH = 'YES'.
000037 PERFORM 900-END-JOB.
000038 STOP RUN.
000039
000040 100-INITIALIZE.
000041 OPEN INPUT INPUT-FILE.
000042 OPEN OUTPUT OUTPUT-FILE.
000043 MOVE 'NO' TO END-OF-FILE-SWITCH
000044 READ INPUT-FILE
000045 AT END MOVE 'YES' TO END-OF-FILE-SWITCH.
000046
000047 200-PROCESS-DATA.
000048 MOVE INPUT-RECORD TO PRINT-LINE.
000049 WRITE PRINT-LINE
000050 AFTER ADVANCING 1 LINE.
000051 READ INPUT-FILE
000052 AT END MOVE 'YES' TO END-OF-FILE-SWITCH.
000053
000054 900-END-JOB.
000055 CLOSE INPUT-FILE.
000056 CLOSE OUTPUT-FILE.
000057//GO.INFILE DD DSN=CISCOB.COBOL.DATA(FOURUP),DISP=SHR
000058//GO.OUTFIL DD DSN=YOUR-ID.DAY.OUTFILE,DISP=OLD
000059//GO.SYSOUT DD SYSOUT=*
000060/*JOBPARM FORMS=F600
****** ********************** BOTTOM OF DATA **************************


In the example above, the lines that contain "//" in
columns one and two, are the JCL statements. JCL statements
perform the operations necessary to compile, link and execute
your program.

Notice that STEP0 executes a JCL procedure called WORKFILE.
This procedure will create an output file named DAY.OUTFILE.
The procedure takes the Data Set Name (DSN) OUTFILE and prefixes
it with the USERID and a Group name of DAY. Disk space for this
file is not charged against your permanent userid space. The disk
space allocation is charged against a system pool. The Group name
of DAY is used to indicate that this file will remain for at least
24 hours from the time it was created.

The RECFM parameter on the WORKFILE procedure is used to create
the output file as a print file when the option FBA is specified.
FBA is the acronym for Fixed Block ASCII. Column one of the print
file is then reserved for printer carriage control. If the output
file is not a print file, I.E. a report to be printed, but is a file
that will be read as input to another program, the option FBA should
be changed to FB. The record length should also be changed in the
LRECL parameter to match that of the record length given in the
COBOL program's File Description 'FD'.

The LRECL parameter on the WORKFILE procedure is used to create
a record length of 133 characters for the output file. This enables
one to use 132 columns for output with the first column reserved for
printer control. When the output file is printed, the printer will
look at the first column to determine the appropriate number of lines
to space and when to paginate.

Notice that STEP1 executes a JCL procedure called COBUCLG.
This procedure will compile, link, and execute a COBOL program.
Within this procedure there are two steps called LNK and GO.
JCL Dataset Definitions and library references may be inserted
into the procedure by prefixing them with the step name followed
by a period. The LNK step contains all the JCL necessary to
to form an executable load module. The GO step contains all of the
JCL necessary in linking input and output data files.

In the example above, GO.INFILE tells the operating system that the
internal link name INFILE is to be used as the link name to the COBOL
program. The Data Set Name (DSN) parameter for GO.INFILE is used
to specify the name of the input file found on disk. In the example
above, the name of the input file on disk is CISCOB.COBOL.DATA(FOURUP).
The link name used for the COBOL program is found in the SELECT clause
on line 14 of the COBOL program.

In the example above, GO.OUTFIL tells the operating system that the
internal link name OUTFIL is to be used as the link name to the COBOL
program. The Data Set Name (DSN) parameter for GO.OUTFIL is used
to specify the name of the output file found on disk. In the example
above, the name of the output file on disk is CISCOB.DAY.OUTFIL.
The link name used for the COBOL program is found in the SELECT clause
on line 15 of the COBOL program.

The Disposition of the file informs the operating system whether or
not the file currently exists. The input file has a file disposition
equal to SHR (DISP=SHR). The output file has a file disposition equal
to OLD (DISP=OLD). This means that we have to create the input and
output files before we execute our program.

SECTION TWO: Creating your data files.

2.1) Type =3.2 at the "COMMAND ===>" prompt to go to the next panel.
Use the TAB key to tab to the "TYPE ===>" prompt. Enter the name
of your input file. Press the HOME key and enter "A" (for
allocation) and press return. another panel will be displayed
as the one shown below. Use these same parameters as input
to your panel.

------------------------ ALLOCATE NEW DATA SET -------------------------
COMMAND ===>

DATA SET NAME: User-id.Initial.Type

VOLUME SERIAL ===> (Blank for authorized default volume)
SPACE UNITS ===>TRKS (BLKS, TRKS or CYLS)
PRIMARY QUAN ===>1 (in above units)
SECONDARY QUAN ===>1 (in above units)
DIRECTORY BLOCKS===>0 (zero for sequential data set)
RECORD FORMAT ===>FB
RECORD LENGTH ===>80 >
BLOCK SIZE ===>80 >

For the RECORD LENGTH and BLOCK SIZE sections, enter the same
number you used in the RECORD CONTAINS clause of this file.
Press return to go back to the DATA SET UTILITY panel. Tab
to the "TYPE ===>" prompt and enter the name of your output file.

2.2) Create your output file the same way you created your input file.


SECTION THREE: Filling in your data.

3.1) Type =2 at the "OPTION ===>" prompt to go to EDIT panel. Enter
the name of your input file. The file name should be entered
at the "TYPE ===>" prompt. This name has to be the same
as the one used in the DSN parameter of your input file. Now,
press return to enter your input data.

3.2) Press the return key. Your screen should have two rows of
asterisks. Move you cursor to the first asterisk on the first
line and type the letter I. After pressing return you will
subsequently be prompted for each line of data. If no data
is entered prompting will stop. You may then move your cursor
to a line number while typing the letter I in order to resume
prompting.

3.3) When you are finished creating your input file, go back to the
EDIT - ENTRY PANEL by typing =2. At the "COMMAND ===>" prompt,
type the name of your output file (this name should be the same
one used in the DSN parameter).
Next, press return, and type SAVE to save the empty output file.
If your Job stream uses a WORKFILE procedure to create the output
file, this step is not necessary.

SECTION FOUR: Executing your COBOL program.


4.1) To execute your program, enter =2 at the "COMMAND ===>" prompt.
Press return to go to the EDIT - ENTRY PANEL.

4.2) Enter the word COBOL at the "TYPE ===>" prompt of this panel.
Then, enter the name of your COBOL program at the "MEMBER ===>"
prompt. Press return and your program will be displayed at
the terminal.

4.3) Enter the command 'SUBT A,10' at the "COMMAND ===>" prompt of
this panel and press return to submit your program to the system.
The "A" is the jobname character that will be suffixed to
your userid. The batch job is to use no more than 10 seconds
of central processing time.


EDIT --- user-id.init.COBOL(TEST1) - 01.01 --------- COLUMNS 001 072
COMMAND ===> SUBT A,10 SCROLL ===>PAGE
****** ******************** TOP OF DATA **************************
000001//STEP0 EXEC WORKFILE,DSN=OUTFILE,LRECL=133,BLKSIZE=13300,
000002// RECFM=FBA
000003//STEP1 EXEC COBUCLG,PARM='LANGLVL(2),APOST'
000004 IDENTIFICATION DIVISION.
000005 PROGRAM-ID. TINY-PROGRAM.
000006 AUTHOR. GORDON HOWELL.
000007
000008 ENVIRONMENT DIVISION.
000009 CONFIGURATION SECTION.
000000 SOURCE-COMPUTER. IBM-370.
000011 OBJECT-COMPUTER. IBM-370.
000012 INPUT-OUTPUT SECTION.
000013 FILE-CONTROL.
000014 SELECT INPUT-FILE ASSIGN TO UT-S-INFILE.
000015 SELECT OUTPUT-FILE ASSIGN TO UT-S-OUTFIL.
000016
000017 DATA DIVISION.
000018 FILE SECTION.
000019
000020 FD INPUT-FILE LABEL RECORDS ARE OMITTED
000021 BLOCK CONTAINS 0 CHARACTERS.
000022 01 INPUT-RECORD PIC X(80).
000023
000024 FD OUTPUT-FILE LABEL RECORDS ARE OMITTED
000025 BLOCK CONTAINS 0 CHARACTERS.
000026 01 PRINT-LINE PIC X(132).
000027
000028 WORKING-STORAGE SECTION.
000029 01 END-OF-FILE-SWITCH PIC X(3).
000030
000031 PROCEDURE DIVISION.
000032
000033 000-MAINLINE-DRIVER.
000034 PERFORM 100-INITIALIZE.
000035 PERFORM 200-PROCESS-DATA
000036 UNTIL END-OF-FILE-SWITCH = 'YES'.
000037 PERFORM 900-END-JOB.
000038 STOP RUN.
000039
000040 100-INITIALIZE.
000041 OPEN INPUT INPUT-FILE.
000042 OPEN OUTPUT OUTPUT-FILE.
000043 MOVE 'NO' TO END-OF-FILE-SWITCH
000044 READ INPUT-FILE
000045 AT END MOVE 'YES' TO END-OF-FILE-SWITCH.
000046
000047 200-PROCESS-DATA.
000048 MOVE INPUT-RECORD TO PRINT-LINE.
000049 WRITE PRINT-LINE
000050 AFTER ADVANCING 1 LINE.
000051 READ INPUT-FILE
000052 AT END MOVE 'YES' TO END-OF-FILE-SWITCH.
000053
000054 900-END-JOB.
000055 CLOSE INPUT-FILE.
000056 CLOSE OUTPUT-FILE.
000057//GO.INFILE DD DSN=CISCOB.COBOL.DATA(FOURUP),DISP=SHR
000058//GO.OUTFIL DD DSN=YOUR-ID.DAY.OUTFILE,DISP=OLD
000059//GO.SYSOUT DD SYSOUT=*
000060/*JOBPARM FORMS=F600
****** ********************** BOTTOM OF DATA **************************

Press the Enter key and the computer will respond with

IKJ56250I JOB useridA(JOBnumber) SUBMITTED
***






SECTION FIVE: Accessing your job output.

5.1) At the "COMMAND ===>" prompt, type =o.h to go to the SDSF or System
Display and Search Facility PANEL H option.

_____________________________________________________________________________
|SDSF HELD OUTPUT DISPLAY ALL CLASSES 406 LINES LINE 1-1 (1)
|COMMAND INPUT ===> SCROLL ===> HALF
|NP JOBNAME TYPE JNUM #DSNS CRDATE C FCB DEST ROUTE #RECORDS RNUM RD-
| S USERIDA JOB 1139 5 8/15/91 X **** GSUMVS1 350 0275
|____________________________________________________________________________






5.2) Tab to the field under the NP heading and type in the letter
S to view you job output.


Below is a facsimile of a successful COBOL execution as viewed
from the SDSF menu option H.

BROWSE - USGHND.DAY.SPF235.OUTLIST ------------ LINE 000000 COL 001 080

COMMAND ===> SCROLL ===>HALF
********************************** TOP OF DATA ************************
1 J E S 2 J O B L O G -- S Y S T E M G S U 1 -- N O
0
11.12.36 JOB 2185 ICH70001I USGHND LAST ACCESS AT 11:09:25 ON TUESDAY, OC
11.12.36 JOB 2185 $HASP373 USGHNDX STARTED - INIT A - CLASS A - SYS GSU1
11.12.45 JOB 2185 - --TIMING
(
11.12.45 JOB 2185 -JOBNAME STEPNAME PROCSTEP RC EXCP CONN CPU
11.12.45 JOB 2185 -USGHNDX COB 00 332 1851 .00
11.12.45 JOB 2185 -USGHNDX LKED 00 332 1851 .00
11.12.45 JOB 2185 -USGHNDX GO 00 332 1851 .00
11.12.45 JOB 2185 -USGHNDX ENDED. NAME-USGHND / TOTAL CPU TIME=
11.12.46 JOB 2185 $HASP395 USGHNDX ENDED ]]
0------ JES2 JOB STATISTICS ------ ]]
- 18 OCT 88 JOB EXECUTION DATE ]]-------------------
- 9 CARDS READ ] A RETURN CODE (RC)
- 152 SYSOUT PRINT RECORDS ] OF ZERO MEANS YOUR
- 0 SYSOUT PUNCH RECORDS ] PROGRAM EXECUTED
- 8 SYSOUT SPOOL KBYTES ] WITHOUT ERRORS.
- 0.17 MINUTES EXECUTION TIME ]
1 //USGHNDX JOB I994998,USGHND, ]--------------------
// NOTIFY=USGHND,CLASS=A,MSGLEVEL=(1,1),
// USER=USGHND,TIME=(0,5)



5.3) To print your Job Stream output, type O under the NP heading.
Your Job Stream output contains such information as the results of
compilation, linkage and execution of your COBOL program. Some COBOL
debugging messages may also be found in your Job Stream Output.
Your Job Stream output will normally be printed on one of the
production laser printers located on the ground floor of the Library
South building. You can change the destination by toggling to the
field under the DEST header and overlaying the GSUMVS1 destination.
For example, if you want your output printed on the high-speed printer
located in LS109, overlay the GSUMVS1 with TRM1.
See the SDSF handout for further information.

5.4) To print your Report file, You might want to use the TSO CLIST
Procedure PRINTOFF.

For example:

SYNTAX:

TSO PRINTOFF Disk-file-name FORMS(form-number)

Note: If no forms are specified, the standard laser print form will
be used. This constitutes four logical pages of output printed
for ever one page of paper. There will be two print images
printed on the front and two print images printed on the
back. For further do*****entation pertaining to laser print
forms, please refer to the do*****entation under the Handouts
procedure.

If the Report file name on disk is DAY.OUTFILE, you would use the
Printoff procedure from any COMMAND===> line as follows:

COMMAND===> TSO PRINTOFF DAY.OUTFILE FORMS(F601)

Note: The Form# F601 is a landscape duplex form. The output will be
printed on the front and back side of the paper lengthwise.
This Form# is often chosen because the legibility of the printer
output is much better.


5.5) An alternative to the TSO PRINTOFF procedure is to use Option 3.6
which will display the HARDCOPY UTILITY screen. This screen may
also be used to print output reports. The following screen sample
demonstrates the printing of the report file named, DAY.OUTFILE,
using Form# F601.


------------------------ HARDCOPY UTILITY -----------------------------
OPTION ==>pk

PK - Print and keep data set
PD - Print and delete data set




DATA SET NAME ===> day.outfile
VOLUME SERIAL ===> (If not catalogued)
DATA SET PASSWORD ===> (If password protected PDS)

PRINT MODE ===> BATCH (BATCH or LOCAL)

SYSOUT CLASS ===> A
LOCAL PRINTER ID ===>

JOB STATEMENT INFORMATION: (If not to local printer, verify before proceeding)
====>/*JOBPARM FORMS(F601)
====>
====>
====>


-----------------------------------------------------------------------

SECTION SIX: Logging off.

To LOGOFF, enter =X at the "COMMAND ===>" or "OPTION ===>"
prompt of any panel. Once the operating system displays the
message READY, you may then type the command LOGOFF.
At this point you will be disconnected from the system.

IMPORTANT NOTE:

The program, input and output files that you have created are
saved in the system. Therefore subsequent executions should
reference sections 4.1 through 5.4.

METHODS OF DEBUGGING

There are two popular ways to debug a COBOL program on the
MVS operating system.

METHOD #1:

If the program compiles with no syntax errors, but continues
to execute beyond the time allocated on the SUBT command, the
program may be in an infinite loop. In order to isolate the
looping pattern you may make use of the COBOL statement
READY TRACE. This command is always placed in column 12
of your program and is placed, just like any other COBOL
statement, within a paragraph. Upon execution of the program,
the name of each paragraph will be written to your SYSOUT.
With this information, you may be able to establish some sort
of looping pattern based on the names of the paragraphs.
The READY TRACE statement requires an additional line of JCL
in order to work. This statement should be typed at the bottom
of your program as follows:

//SYSOUT DD SYSOUT=*

METHOD #2:

If you want to take a peek at a given variable in your program,
you may do this using the COBOL DISPLAY statement. If you have
a variable named CNTR, you may look at the contents of this
variable using the DISPLAY statement. It might look as follows:

DISPLAY CNTR.

The DISPLAY statement also starts in column 12. The DISPLAY
statement also requires an additional line of JCL in order to
work. This statement should be typed at the bottom of your
program as follows:

//SYSOUT DD SYSOUT=*


MOST FREQUENTLY ENCOUNTERED ERROR MESSAGES
WHEN USING COBOL ON AN IBM MVS/XA OPERATING SYSTEM



Job streams used to compile COBOL programs are capable of generating
four types of error messages. They are listed as follows:

1. Job Control Language (JCL) syntax errors:
A JCL syntax error is flagged by the operating system. Think of it as
a grammatical error. These errors will be flagged on those statement
lines containing '//'. The line numbers for which syntax errors are
flagged will be placed at the bottom of your Outlist file.
Common JCL syntax errors include missing commas, or incorrect Disposition
parameters.

2. Job Control Language (JCL) run time errors:
A JCL run time error is an error that is generated once the JCL job stream
successfully passes the syntax checker. Common JCL run time errors
include missing Data Definition DD statements, the Region size for core
memory is not large enough, not enough disk space available for
output files, and not enough time allocated to the batch job.

3. COBOL syntax errors:
A COBOL syntax error is flagged by the COBOL compiler upon compilation of
the program. Think of it as a grammatical error of the COBOL language.
These are COBOL statements written by the programmer for which the compiler
does not understand. A listing of all statement errors and the line
number for which they are found will be appended to the bottom of the
COBOL listing.

4. COBOL run time errors:
A COBOL run time error is usually the last of the errors that will be
generated. Before this kind of error is generated all JCL syntax and
run time errors have been corrected. COBOL run time errors, however,
may be found in conjunction with COBOL syntax errors. If a COBOL program
is compiled without FATAL errors but still contains one or more serious
errors, executable code may be generated by the compiler and executed.
This code, while not correct, may partially run and eventually produce
a run time error which should be ignored until all COBOL syntax errors
have been corrected, otherwise, the run time diagnostics will be
meaningless as well as misleading.




COMMON COBOL RUN TIME ERRORS

At the top of the output listing, you should look for the lines that contain
a Return Code for each JCL step. This will be the letters "RC" followed by
a two digit number. If this number is "00" then the step completed normally.
If the RC code is other than "00", then you may assume the JCL step may have
a problem. The only time you should not be concerned is when a JCL step
used to create a DAY file generated a return code of "04". This Return Code
will be generated if the DAY file from a previous run currently exists. It
should not be cause for alarm. Since the DAY file already exist it will not
be created again. If, however, you wish to change the record length of that
DAY file, you should physically erase the file and re-submit the Job stream.
You will then receive a return code of "00". Even though you have changed
the record length in your JCL for the DAY file, the record length will not
be changed until the file has been deleted and re-created.

Return codes greater than "00" on the COBOL compiler step are reason for
concern and usually represent the presence of COBOL syntax errors that may
be found at the bottom of the COBOL listing.

The error message ABEND followed by a three character code is generated
by the Operating system. ABEND - stands for Abnormal End.



ABEND (0C1) - OPERATION EXCEPTION.

COBOL programs that contain logic errors often trigger
Operation Exception errors.

The following are some common causes:

* Attempting to read or write a file before it has been
opened or after it has been closed.

* Failure to close files before the STOP RUN statement is
executed.

SOLUTION: Make sure files are opened before any Read or
Write is issued. Make sure the program does
in fact have a STOP RUN to terminate the execution
of the program. Without this statement, the files
are usually closed and logic execution continues
dropping thru one paragraph and then the other
until the program encounters a READ or WRITE
operation which then results with an ABEND (OC1)


ABEND (OC4) - PROGRAM INTERRUPTION
The COBOL program has attempted to access or move data to an
area of storage that does not belong to the program.

* The virtual segment or page was never allocated.

SOLUTION: Make sure that all vectors and arrays have been
dimensioned using the OCCURS clause.
Make sure that counter variables used in subscripting
the vectors and arrays do not access storage beyond
the maximum storage allocation as defined by the
OCCURS clause.

ABEND (OC7) - DATA EXCEPTION
The COBOL program is trying to manipulate data in some illegal
fashion.

* A numeric field has not been initialized and it is being
used in some numeric computation.

* An edited numeric field is being moved to a non-numeric field.

* An edited numeric field is being used in a numeric computation.

* Input data fields are misaligned with the data being read.
Arithmetic computations encounter data with non-numeric
information.

* Division by zero.

SOLUTION: Make sure that all edited numeric fields are used
only for output.
Make sure that all counters and ac*****ulator variables
have been initialized to zero.
Check your input fields and make sure they match
the record description as defined on disk.

ABEND (0C8) - FIXED POINT OVERFLOW EXCEPTION

* High-order significant bits are lost in a fixed-point add,
subtract, shift, or sign-control operation.

SOLUTION: Increase the size of the resultant numeric field.
We recommend that you use an ON SIZE error phrase
with computational formulas that might present a
problem.


ABEND (0C9) - FIXED POINT DIVIDE EXCEPTION

* A quotient exceeds the register size in fixed-point division,
including division by zero, or the result of a Convert to
Binary (CVB) instruction exceeds 31 bits.

SOLUTION: Check for looping problem or numbers in formulas that
may grow in some exponential fashion. If a large
numeric calculation is possible, consider using
packed decimal COMP-3 for numeric calculations.
This not only saves on space but also allows for
larger numbers to be used in computations.
It is a good practice to validate the divisor field
to ensure that it does not contain a zero.

ABEND (OCA) - DECIMAL-OVERFLOW EXCEPTION.

* The destination field is too small to contain the result field
in a decimal operation. 
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值