You are on page 1of 4

https://teams.microsoft.

com/l/meetup-join/
19%3ameeting_ZTBiYzgxNGItMTMzNy00MmM5LWJhZDAtMTgwY2FiNjYzNzEy
%40thread.v2/0?context=%7b%22Tid%22%3a%2276a2ae5a-9f00-4f6b-95ed-
5d33d77c4d61%22%2c%22Oid%22%3a%22bc93db9c-5d2f-41aa-8b6d-4ba906c5122c
%22%7d
-------------------------------------------------------------------------
-------------------------------------------------------------------------
-------------------------------------------------------------------------
------------------------

INSTRUCTIONS :-
---------------
01. Allocate a PDS CAPGAXX.COBOL.DAY01 using =3.2 option.
02. Create a member PGM0101 in the above PDS and type the source code
discussed.
03. Open compiler JCL - CAPGAXX.JOBLIB(COBCOMP).
Change the values in SRCLIB to CAPGAXX.COBOL.DAY01 and in MEMBER to
PGM0101
04. Submit the JCL.
05. Open run JCL - CAPGAXX.JOBLIB(COBRUN)
06. Change the value in PGM to PGM0101.
07. Submit the JCL
08. Goto spool and see the output in SYSOUT.
-------------------------------------------------------------------------
----------------------------------------------------
06. Open the program and change the message in DISPLAY statement.
07. Run the program.
08. Goto spool and see the output. You will see the old message since you
have not compiled the program.
09. Compile the program.
10. Run the program.
11. Goto spool and see the output. You will see the modified message.
-------------------------------------------------------------------------
----------------------------------------------------
12. Open the program and make a spelling mistake in the word DIVISION.
13. Compile the program. You will get an error.
14. Goto spool and see the error message in SYSPRINT COBOL.
15. Type M and press F8 function key to see the error message.
16. Note the error message and the line number and press F7 multiple
times till you see the line number.
17. Go back to your code and rectify your mistake.
18. Compile the program. Now it will compile successfully.
19. Run the program.
20. Goto spool and see the output.
-------------------------------------------------------------------------
----------------------------------------------------

IF - END-IF
-----------

Syntax :-

IF condition
statement-1
statement-2
ELSE
statement-3
statement-4
statement-5
END-IF.
statement-6.

Points :-
01. If the condition satisfies, statement-1, statement-2 will be
executed and the control will then pass to statement-6.
02. If the condition does not satisfy, statement-3, statement-4,
statement-5 will be executed and the control will pass to
statement-6.
03. statement-6 will always execute and is not depending on the
condition.
04. In a IF - END-IF, . (period) must be coded after END-IF only.
05. END-IF marks the end of IF statement. Every IF must have its
own END-IF.

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

PERFORM
-------
- PERFORM statement is used to make your code modular.

- Syntax :-

PERFORM para-name.

Example :-

PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "HELLO".
PERFORM PARA-1.
DISPLAY "BYE".
STOP RUN.
PARA-1.
DISPLAY "INSIDE PARA-1".
EXIT.

OUTPUT :-
---------
HELLO
INSIDE PARA-1
BYE

- EXIT statement will exit the paragraph and pass the control back to the
next statement after PERFORM statement.
-------------------------------------------------------------------------
----------------------------------------------------

Assignment 01
-------------

01. Input roll number, student name and marks in subject1, subject2,
subject3. Calculate total and percentage and display all the
details of the student.

roll number 9(03), student name A(15), marks in subject1 9(02)V9(02),


marks in subject2 9(02)V9(02), marks in subject3 9(02)V9(02),
total 9(03)V9(02), percentage 9(02)V9(02).

Total is calculated as the addition of all the marks.


Percentage is calculated as Total / 3.

The program should work for 2 students.

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

02. Input employee number, employee name and basic salary.

DA is 40% of basic salary for all employees.

HRA is calculated as follows :-


If basic salary < 25000, HRA is 20% of basic salary else it is 30% of
basic salary.

Calculate the gross salary as the addition of basic salary, DA and


HRA.

The program should display employee number, employee name, basic


salary, DA, HRA and gross salary.

empno 9(03), employee name A(15), basic salary 9(06)V9(02), DA


9(06)V9(02), HRA 9(06)V9(02), gross salary 9(06)V9(02).

The program should work for 4 employees.

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

STEP01 USING INSTREAM DATA


--------------------------
//STEP01 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
101 MAHESH 024000
102 SURESH 045000
103 ARUN 021000
/*
//SYSUT2 DD DSN=CAPGA01.EMP.DATA,DISP=OLD
//SYSIN DUMMY

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

You might also like