Write A COBOL Program For Matrix Addition
Write A COBOL Program For Matrix Addition
Write A COBOL Program For Matrix Addition
1.dentification division.
programe id. x.
enviroment division.
data division.
warking-storage section.
procedure division.
inline perform to reach 2y2 or 3y3 matrix. e.g.
Perform varying I from 1 by 1 until i > 3
Perform varying J from 1 by 1
until J > 3
Add Matrix1(I,J) to
Matrix(I,J)giving
Marix3(I,J)
End-Perfrom
End-Perfrom.
2.identification division.
programe id. x.
enviroment division.
data division.
warking-storage section.
procedure division.
inline perform to reach 2y2 or 3y3 matrix. e.g.
Perform varying I from 1 by 1 until i > 3
Perform varying J from 1 by 1
until J > 3
Add Matrix1(I,J) to
Matrix(I,J)giving
Marix3(I,J)
End-Perfrom
End-Perfrom.
2. Question :
77 I PI 9.
PERFORM VARYING I FROM 1 BY 1 UNTIL>10
DISPLAY 'OK'
END-PERFORM.
What output/msg is likely when this program is executed thru JCL?
A.1.This loop will give compilation error becoz value of I is declared for only one digit , when loop
reaches to 10 it will find mismatching b/w I & the current value i.e. 10.
At Run time when Varibale I reached to 10 then in working storage variable which is declared as 9(01)
can hold 0 not 10
So Program goes into loop result in Timeout Error S322.
A.3. 77 I PI 9.
PERFORM VARYING I FROM 1 BY 1 UNTIL I >10
DISPLAY 'OK'
END-PERFORM.
--> Hi.. Nothing is there in the above program..we have one loop in the program it will run until I > 10
--> that means it will run until I value becomes 11. Now observe the I values when the loop is running
--> When the first time loop runs I value is I=1.
--> I was declared as 77 I PIC 9. it is same as 77 I PIC 9(1). when the loop runs 10th time I value becomes
10.. 10 is a two digit number. But i can hold only one digit number..So here data truncation will be
happened.
Q.3. Question :
What is meant by abbend and what is the difference between abbend and error.
when does and why dose it come.
what are the types?
A.1. Abend is short for Abnormal end, abend is a term used to describe when a program or task ends
without warning. Generally when an abend is encountered the user will receive some type of error
message.
Error occurs because of Syntax problems or dataset disposition issues etc, whereas Abend occurs
because of some functional problems
Types:
SB37 - End of Volume
SE37 - Maximum extents reached
S013 - Member not found
S80A - Region limit violation
A.2. abend occures during the execution of program.error occures before execution of the
program due to the syntax coding in a program.
Q.4. Question :
Write a COBOL program for Matrix Addition?
What are the sections available in Data division in COBOL?
Explain me about Report Section.
2)File Control Setion, Working Storage Section, Linkage Section, Reporting Section, Screen
Section.
Q.5. Question :
Explain the difference between an internal and an external sort, the pros and cons, internal sort
syntax etc.
A.1. internal sort done by cobol & external sort dine by jcl.
the syntax for internal sort is
sort file3 on a/d key key-name using i/p-filename giving o/p-filename
inter sort=cobol
external sort= jcl
Question :
Give brief me about changeman & expidator tool.
A. Expeditor Tool :
This is a debugging tool. Handly tool mostly widely used everywhere. There are two types of
expediting, online exped and batch exped.
For online exped, you may first need to compile and link your module. Supply your link to
the exped job. The exped will pick the module. You can use breakpoint for exped.
Its all depends how your envirnornment allows you to set up.
Question :
What is the difference between RETURN CODE & MAXCC CODE
A. A RETURN_CODE shows the status of each step within a job, the maximum
RETURN_CODE is 256, where as
MAXCC is used for the final output of the programe. If the MAXCC is ZERO then job is
executed successfully. In MAXCC we have 0,2, 4, 8.
MAXCC is the Maximum of all the return codes of all the steps in JCL.
Question :
Can we reverse the string in cobol ? See the following problem :
Question :
How can we pass data from cobol to JCl?
A.You can pass the data from COBOL to JCL using RETURN-CODE. This is a global variable which can be
accessed by JCL and COBOL. But this is used to hold return code of program.
MOVE 04 TO RETURN-CODE.
You can also open a file in cobol and write to it. This can be used in JCL subsequent steps.
Question :
What is a bind?
A. A bind associates record types with the program work area; for run unit and records it is the
first command issued in the program.
Binding is a process that creates the access path logic for the sql statements within a cobol
program. after precompilation of a cobol program a dbrm(has all the embedded sql statements) is
created. This dbrm is then bound to form a plan(executable form of the sql statements).
Question :
A.Yes we can use redefines clause in occurs clauseeg:01 number1 pic x(10) value spaces.01
number2 redefines number1 pic x occurs 10 times.
Question :
What does a FINISH do?
Answers:
Question :
How is sign stored in a comp-3 field?
A. It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last
byte, hex 1C if your number is 101, hex 2C if your number is 102, hex 1D if the number is -101,
hex 2D if the number is -102 etc.
Question :
What is the difference between STOP & STOP RUN ?
Question :
What is the difference between performing a SECTION and a PARAGRAPH?
Answers:
Performing a SECTION will cause all the paragraphs that are part of the section, to be
performed.
Question :
What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)? ( applicable to only
MVS/ESA Enterprise Server).
Answers: