Wednesday 22 August 2012

ACCEPT and DISPLAY verb


ACCEPT verb.

This Verb will helps to read data from JCL or from the system.
 
SYNTAX:
ACCEPT data-item from {day,date,time}

Ex:
ACCEPT WS-NAME.
ACCEPT WS-DATE from DATE.

This will not accept any data from user after program execution.

This will accept data from JCL or from operating system like day date.

Not accept any data from other variable from declared data division.

Program for ACCEPT verb:

See below 2 division that i declared to show you how ACCEPT verb works.

In my IDENTIFICATION DIVISION i have mentioned my PROGRAM-ID is ADDN.

I am declaring two variables NUM1 and NUM2 with there values 5 and 4 respectively.

ADD1 is RESULT variable which stores addition result.

CURRENT-DATE variable stores DATE from system.

CURRENT-TIME variable stores TIME from system.


Now moving towards next division which is most important is the PROCEDURE DIVISION.
Here i am going to code a logic for my Accept verb.

PROCEDURE DIVISION:


System must accept these variables to process the result so without accepting any variable you can’t perform any operation.

Now you have ACCEPTed the variables here you can’t see what you have accepted so to display any instruction or DATA-ITEM content we are going to use “DISPLAY” verb.

After compiling the above source code i got below load module.

Load Module:


After Running above program my final output is


OUTPUT:


DISPLAY verb.

This verb will display user message or data-item on screen.

SYNTAX:
DISPLAY {data-item,literal}

EX:
DISPLAY WS-NAME.
DISPLAY THE NAME IS: STUDENT-NAME.


Program for DISPLAY verb:

See below 2 division that i declared to show you how ACCEPT verb works.

In my IDENTIFICATION DIVISION i have mentioned my PROGRAM-ID is ADDN.

I am declaring two variables NUM1 and NUM2 with there values 5 and 4 respectively.

ADD1 is RESULT variable which stores addition result.

CURRENT-DATE variable stores DATE from system.

CURRENT-TIME variable stores TIME from system.


PROCEDURE DIVISION:


Here what you have ACCEPTed will going to display on Screen.

STOP RUN is a last statement which tells system that this is my last statement of program.
 
LOAD MODULE:


OUTPUT:






No comments:

Post a Comment