0% found this document useful (0 votes)
58 views66 pages

Cobol - Day 01

COBOL is a programming language used to develop business applications. It is suitable for batch and online applications like payroll processing, banking, and reservations. COBOL has four main divisions - identification, environment, data, and procedure. The identification division identifies the program. The environment division defines data sets and devices. The data division describes data structures. The procedure division contains processing logic. COBOL remains an important language for maintaining legacy applications.

Uploaded by

monudaharwal03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views66 pages

Cobol - Day 01

COBOL is a programming language used to develop business applications. It is suitable for batch and online applications like payroll processing, banking, and reservations. COBOL has four main divisions - identification, environment, data, and procedure. The identification division identifies the program. The environment division defines data sets and devices. The data division describes data structures. The procedure division contains processing logic. COBOL remains an important language for maintaining legacy applications.

Uploaded by

monudaharwal03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 66

Introduction to COBOL

COBOL is an acronym which stands for

COMMON BUSINESS ORIENTED LANGUAGE

COBOL is used for developing typically


file oriented BUSINESS applications
Suitable for batch processing applications like
Payroll, Telephone, Electricity Billing and Financial
Accounting etc.,

Batch processing is also known as periodical


processing
With CICS (Customer Information Control System) as
front end, COBOL is suitable for Online applications
like
Railway Reservation, Online Banking etc.

COBOL is not suitable for developing system


programs like OS, drivers

COBOL is one of the oldest computer languages in


use (it was developed around the end of the 1950s).
ADVANTAGES OF COBOL
o Higher Level Language

o English Like Language

o Self documenting Language

o File handling capability

o Easy to write and available across


several platforms

o Largely Machine independent


COBOL was developed in 1959 by a group called
CODASYL

(COnference on DAta SYstems Language)

Later ANSI standards were introduced

o COBOL – 68
o COBOL – 74
o COBOL – 85
o COBOL – 2003
o Enterprise COBOL
FUTURE OF COBOL

o COBOL will remain an important


language in future also

o Billions of lines of COBOL source are


currently in use with millions added each
year

o Since 1000s of COBOL programmers


retire every year there is a continuous
requirement of trained man power
FUTURE OF COBOL

 Trained man power in COBOL for Maintenance


and Development of COBOL based applications
COMPARISON OF IBM COBOL COMPILERS
EXTENSIONS
FOR OOCOBOL,
C INTEROPERABLITY

INTRINSIC INTRINSIC
FUNCTIONS, FUNCTIONS,
SUPPORT FOR SUPPORT FOR
LANGUAGE LANGUAGE
ENVIRONMENT ENVIRONMENT

COBOL 85 STD. COBOL 85 STD. COBOL 85 STD.


DBCS, DBCS, DBCS,
IMPROVED IMPROVED IMPROVED
CICS CICS CICS
INTERFACE, INTERFACE, INTERFACE,
31 BIT 31 BIT 31 BIT
ADDRESSING , ADDRESSING, ADDRESSING,
SAA SUPPORT, SAA SUPPORT, SAA SUPPORT,
COBOL 74 STD. ETC. ETC. ETC.

COBOL 74 STD. COBOL 74 STD. COBOL 74 STD.

OS/VS COBOL VS COBOL II COBOL/370


COBOL FOR MVS & VM
IBM's latest host COBOL compiler
- For writing a COBOL program you have to be provided
with program specification by your BUSINESS
ANALYST

- ANALYST studies a customer’s requirement for an


application package and prepares an over all design
and finally comes out with a detailed specification for
every program to be developed under an application
The specification will contain the details of
INPUT/OUTPUT file descriptions, OUTPUT report
layouts and descriptions, processing specifications,
calculation methods etc.,

A set of test data is required to ensure that the


programs work as intended by the designer and
customer
A COBOL Program is divided into

o DIVISION
o SECTION
o PARAGRAPH
o SENTENCE
o STATEMENT
o WORDS
o CHARACTERS
COBOL words are two categories, reserved words
and user defined words

USER defined words can be variables declared in


DATA DIVISION and PARAGRAPH NAMES in
PROCEDURE DIVISION, Which we will see
later
COBOL RESERVED WORDS

The COBOL language has over 300 words which have a


special significance to the compiler are called
RESERVED words

USER defined variables must not coincide with


RESERVED words

Reserved Word Examples below shown:

DIVISION, SECTION, STORAGE, ADD, ACCEPT,


STOP, COMMA, DIVIDE, DYNAMIC, LINKAGE ,
READ , WRITE ETC.,
COBOL Coding Format
Columns
| | | | |
| | | | |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |……………| 71 | 72 |
|---------- 1 ------| |------3 ---|------------------------------
4 ------ ----------|

Rows
2
1. Sequence Number Area
2. Indicator Area
3. Area ‘A’ or Margin ‘A’
4. Area ‘B’ or Margin ‘B’
Indicator Area Characters

1. * (Asterisk) - Comment
2. / (Slash) - Comment + page feed
3. - (Hyphen) - String Continuation
Margin A is to be used for writing

o DIVISION NAMES
o SECTION NAMES
o PARAGRAPH NAMES
o 01 77 LEVEL ENTRIES
o FD ENTRIES

Margin B is to be used for writing

o 02-49 66 88 LEVEL ENTRIES


o SELECT STATEMENTS
o PROCEDURE DIVISION STATEMENTS AND
SENTENCES
Four Divisions of COBOL

DIVISIONS/SECTIONS identify various parts of a COBOL


program

File declarations,
descriptions,
temporary variables,
processing logic,
communication with other programs etc are handled by
various DIVISONS/SECTIONS of a COBOL program
Four Divisions of COBOL

There are four DIVISIONS in all.

IDENTIFICATION DIVISION ( MANDATORY )

ENVIRONMENT DIVISION ( OPTIONAL )

DATA DIVISION ( OPTIONAL )

PROCEDURE DIVISION ( MANDATORY )


Functions of the four divisions

 The IDENTIFICATION DIVISION is used to specify the


name of program and programmer.

 The ENVIRONMENT DIVISION is used to define the


data sets that are used by a program and links the
data sets to the corresponding DD names of JCL
.Functions of the four divisions
 As the name suggests, the DATA DIVISION is
used to provide the complete descriptions of data
sets including record description and field
description and working storage variables.

 The PROCEDURE DIVISION contains executable


instructions ( statements containing VERBS ) to
process the data contained in DATA DIVISION.
Functions of the four divisions

COBOL provides a means for specifying


sequence, selection and iteration constructs to
code your processing logic.
COBOL coding rules

 COBOL coding lines start in Margin A or Margin B


 DIVISION, SECTION, PARAGRAPH names start in
Margin A
 FD entries,01,77 level entries, Procedure division
paragraph names start in Margin A.
 Where as STATEMENTS, 02-49, 66, 88 level
entries start in Margin B.
 Again, Procedure division sentences, statements
start in Margin B.
A SAMPLE COBOL program

( just see the structure - don’t worry about the details)

IDENTIFICATION DIVISION.
PROGRAM-ID. FIRST001.
AUTHOR. SRG.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUM1 PIC 9 VALUE ZEROS.
77 NUM2 PIC 9 VALUE ZEROS.
77 RESULT PIC 99 VALUE ZEROS.
77 WS-NAME PIC X(10) VALUE ‘MAPLES’.
PROCEDURE DIVISION.
CALC-RTN1.
ACCEPT NUM1.
ACCEPT NUM2.
MULTIPLY NUM1 BY NUM2 GIVING RESULT.
DISPLAY "RESULT IS = ", RESULT.
STOP RUN.
Another SAMPLE COBOL program.

IDENTIFICATION DIVISION.
PROGRAM-ID. TEST1.
AUTHOR. SRG.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT STUDENT-FILE ASSIGN TO DD1
ORGANIZATION SEQUENTIAL
ACCESS SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD STUDENT-FILE.
01 STUDENT-REC.
02 ST-EC PIC 9(4).
02 ST-ENAME PIC X(15).
02 ST-BASIC-PAY PIC 9(4)V99.

Continued..
WORKING-STORAGE SECTION.
77 WS-CTR PIC 9(5) VALUE 123.
01 WS-REC.
02 WS-EC PIC 9(4).
PROCEDURE DIVISION.
DISPLAY …………..
OPEN ………..
RTN1.
READ …………AT END CLOSE ……
NOT AT END
MOVE ……….
COMPUTE ……………
ADD ……….
WRITE …………
GO TO RTN1
END-READ.
IDENTIFICATION DIVISION
- IT IS THE SMALLEST AND LEAST SIGNIFICANT DIVISION

- IT IS USED TO IDENTIFY THE PROGRAM AND AUTHOR

- IT DOES NOT HAVE SECTIONS

- IT CONTAINS ONLY PARAGRAPHS


IDENTIFICATION DIVISION
PROGRAM-ID. TEST123.
AUTHOR. RAJ.
INSTALLATION. MAPLES.
DATE-WRITTEN. 21-08-1999.
DATE-COMPILED. 23-08-1999.
IDENTIFICATION DIVISION

PROGRAM-ID is the only required paragraph for this division

Program name can be 1 – 30 characters with at least one Alphabet,


but Mainframe accepts only 8 characters as program name

All other entries are OPTIONAL and for documentation purpose only
ENVIRONMENT DIVISION

 THIS FOLLOWS THE IDENTIFICATION DIVISION.

 THIS IS THE MOST HARDWARE DEPENDENT DIVISION.

 THE COMPUTER AND OTHER DEVICE REQUIREMENTS ARE


DESCRIBED IN THIS SECTION.

 IT HAS 2 SECTIONS
ENVIRONMENT DIVISION

ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
SOURCE COMPUTER. S390. (where the program is compiled)
OBJECT COMPUTER. S390. (where the program is executed)

INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT employee-master ASSIGN TO DD1.
organization is sequential.
I-O-CONTROL.
SPECIAL-NAMES.
CURRENCY SIGN IS literal-1.
DECIMAL POINT IS COMMA.
DATA DIVISION

- Has two sections FILE SECTION and WORKING-


STORAGE SECTION

- Describes the characteristics of files used in the


program like
REC SIZE, BLOCK SIZE, FORMAT ETC…

- It contains RECORD STRUCTURE and FIELD


DESCRIPTION entries.

- All the above are declared in FILE SECTION


DATA DIVISION

- DATA DIVISION has working-storage section to


declare temporary memory variables used in the
program.

- In essence, the contents of FILE SECTION variables


are stored in the devices like hard disk/printer where
as the contents of WORKING-STORAGE section
are in RAM buffers and are lost once the program is
terminated
DATA DIVISION
DATA DIVISION HAS SIX SECTIONS AS PER STANDARDS BUT
MAINFRAME COBOL HAS ONLY FOUR SECTIONS

• FILE SECTION.
• WORKING-STORAGE SECTION.
• LINKAGE SECTION.
• LOCAL-STORAGE SECTION.

• REPORT SECTION
• SCREEN SECTION.

The last 2 sections are not supported in IBM MAINFRAME COBOL

SCREEN SECTION REQUIREMENTS ARE TAKEN CARE BY THE OLTP


SOFTWARE CICS (Customer Information Control System)
DATA DIVISION

The DATA DIVISION has the following structure

DATA DIVISION.
FILE SECTION.
……….. FILE SECTION ENTRIES …………..
WORKING-STORAGE SECTION.
……TEMPORARY MEMEORY VARIABLES, GROUP AND ELEMENTARY ITEMS..

EXAMPLE:
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE1.
AUTHOR. SRG.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 Num1 PIC 9 VALUE ZEROS.
01 Num2 PIC 9 VALUE ZEROS.
01 Result PIC 99 VALUE ZEROS.
VARIABLES
Let us start with working- storage section

VARIABLES can be declared in WS section

Variables are also known as data items or identifiers

A data item starts with a level number followed by


name, PIC clause and optionally VALUE and other
clauses
VARIABLES

A variable name can be maximum of 30 characters


consisting of A-Z,0-9,hiphen

No other special characters, no blanks are allowed.

Must have at least one Alphabet


DATA ITEMS / VARIABLES

Data Items can be ELEMENTARY OR GROUP ITEMS

ELEMENTARY ITEM is one that cannot be further


subdivided

A set of related ELEMENTARY ITEMS is called a


GROUP ITEM 01 LEVEL is used for declaring group
items
DATA ITEMS / VARIABLES

ELEMENTARY ITEMS which are not part of any


Group is called INDEPENDENT ELEMENTARY
ITEMS

Generally Independent elementary items are declared


in Working Storage Section with Level Number 77

Independent elementary items can also be declared


with level number 01 from COBOL-85 version
DATA ITEMS / VARIABLES
- 01 AND 77 LEVEL ITEM NAMES MUST BE UNIQUE

- 01 LEVEL is also used for declaring Group Items, in


which case it may have sub level items with level
numbers 02-49

- 02-49 Level data items may have duplicates


( Duplicate items can be qualified – later we will
discuss)

- 01 - 77 levels are used in MARGIN-A where as other


levels in MARGIN-B
COBOL Data Types

There are three basic data types in COBOL

Numeric, Alphabetic, Alphanumeric

Data type is important because it determines how the


data has to be stored inside the variable and what
operations are valid on such variables
COBOL Data Types

The contents in ALPHANUMERIC items are left


justified

The contents in NUMERIC items are right justified

 COBOL’s weakness is, it is poor in type checking and


enforcing
How to declare Variables in WS?
Variables are declared with a level number, user defined name and PIC clause

WORKING-STORAGE SECTION.

77 WS-NAME PIC X(15) VALUE “MAPLES”. MAPLES---------

77 WS-CTR1 PIC 9(6) VALUE 1234. 001234

77 WS-CTR2 PIC 9(4) VALUE ZERO. 0000

77 WS-LINE PIC X(10) VALUE ALL “-”. ------------

77 WS-ADDR PIC X(10) VALUE SPACES. Blank Spaces

77 WS-AMT PIC 9(4)v9(3) value 12.56 0012560

 Level number 77 indicates the item is independent data item


 PIC means PICTURE Clause indicating the type and size of the item
 Type can be X A 9 indicating alphanumeric, alphabetic, Numeric items
How to declare Variables in WS?

VALUE indicates the initial contents of the variable

The constants are three types in COBOL

STRING CONSTANT, NUMERIC CONSTANT,


FIGURATIVE CONSTANT
How to declare Variables in WS?
Though the initial values are called constants, the
contents can be modified late in the program

The max size of X and A is 32000 chars without value


clause and 160 with VALUE clause

For numeric data item max allowed is 18 digits but


mainframe COBOL allows up to 31 digits
( you have to set the compiler option
PARM.COBOL=ARITH(EXTEND)
More examples
77 WS-CTR2 PIC 9(05) VALUE 123. ( STORED AS
00123 )
77 EMP-NAME PIC A(15) VALUE ‘MAPLES’.
01 EMP-ADDRESS PIC X(12) VALUE “12,III STREET”.

01 WS-GRP.
02 WS-EC PIC 9(03).
02 WS-EN PIC X(12).
02 WS-DOB.
03 WS-DD PIC 9(02).
03 WS-MM PIC 9(02).
03 WS-YY PIC 9(02).

01 WS-GRP.
05 WS-EC PIC 9(03).
05 WS-EN PIC X(12).
05 WS-DOB.
10 WS-DD PIC 9(02).
10 WS-MM PIC 9(02).
10 WS-YY PIC 9(02).
Figurative Constants

 COBOL provides its special type of constants called Figurative Constants.

 SPACE or SPACES

 ZERO or ZEROS or ZEROES equivalent to 0

 QUOTE or QUOTES = "

 HIGH-VALUE or HIGH-VALUES = Max Value

 LOW-VALUE or LOW-VALUES = Min Value

 ALL literal = filling with character


PROCEDURE DIVISION

 The PROCEDURE DIVISION is where all the data


described in the DATA DIVISION is processed .

 It contains the logic to process the data .

 There must be at least one paragraph, sentence and


statement in the PROCEDURE DIVISION.
PROCEDURE DIVISION

 The PROCEDURE DIVISION is hierarchical in


structure and consists of Sections, Paragraphs,
Sentences and Statements.

 The paragraph and section names in this division are


chosen by the programmer meaningfully
PROCEDURE DIVISION

This is the fourth division of a COBOL PROGRAM.

It contains SECTIONS/ PARAGRAPHS defined by users

PARAGRAPHS Contain ( Instructions ) Statements to


be executed
PROCEDURE DIVISION

 STATEMENTS are used to process the data items

 A STATEMENT starts with a verb like OPEN,


ADD, MOVE, DISPLAY etc.,

 A set of COBOL STATEMENTS can be grouped


using a PARAGRAPH NAME
PROCEDURE DIVISION

o PARAGRAPH MUST BEGIN IN MARGIN A

o MUST NOT HAVE MORE THAN 30 CHARACTERS.

o MUST NOT BE A COBOL RESERVED WORD.

o MUST NOT HAVE ANY SPECIAL CHARACTERS EXCEPT


HYPHEN (-)

o MUST BE generally UNIQUE.


PROCEDURE DIVISION

PROCEDURE DIVISION.
MAIN-PARA.
ADD A TO B.
MOVE B TO F.
.
.
EXIT-PARA.
STOP RUN.
-------------------------------------------------------------------------------------------------------------------------

MINIMUM COBOL RPOGRAM

IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE2.
PROCEDURE DIVISION.
DISPLAY “HELLO WORLD".
STOP RUN.
First PROCEDURE DIVISION STATEMENT

Display statement will show the contents of a variable or literal in the output or
SPOOL (SYSOUT )

IDENTIFICATION DIVISION.
PROGRAM-ID. PRG1.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NAME PIC X(10) VALUE ‘MAPLES’.

PROCEDURE DIVISION.
DISPLAY “HALLO” WS-NAME.
STOP RUN.

Note: DISPLAY statement IN MAIN FRAME COBOL CANNOT control the


LINE or COLUMN position of the SCREEN
You have to use multiple display statements to
show the contents on separate lines

IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOPRG1.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NAME PIC X(10) VALUE ‘MAPLES’.
PROCEDURE DIVISION.
DISPLAY “HALLO”
DISPLAY WS-NAME.
DISPLAY “HOW ARE YOU?”.
STOP RUN.
Program Preparation

Allocate the following PDS in the following format

<USERID>.DEV.JOB (To keep all your JCL’s)

<USERID>.DEV.PROCLIB (To keep all your Procedure)

<USERID>.DEV.SOURCE (To keep all your programs)

<USERID>.DEV.LOADLIB (To keep all your Load Module)


Procedure to compile and execute a COBOL program using two JCLs
COMPLINK and RUNJCL

(You have to use two JCL’s one to compile and create load module and one to
run your program (RUNJCL)

COMPLIER JCL

//MAPLE06R JOB NOTIFY=MAPLE06,CLASS=M


// JCLLIB ORDER=(ZOS.PROCLIB)
//S1 EXEC PROC=IGYWCL,MEM=PRG1
//COBOL.SYSIN DD DSN=<USERID.DEV.SOURCE>(&MEM),DISP=SHR
//LKED.SYSLMOD DD DSN=<USERID.DEV.LOADLIB>(&MEM),DISP=SHR
//
THIS JCL IS USED TO COMPILE YOUR COBOL PROGRAM PRG1, CHECK FOR SYNTAX
ERRORS AND SAVE THE LOAD MODULE IN <USERID>.DEV.LOADLIB

IGYWCL IS A CATALOGED PROCEDURE GIVEN BY IBM


How to execute your load module?

RUNJCL

//MAPLE06R JOB NOTIFY=&SYSUID,CLASS=M


//JOBLIB DD DSN=<USERID.DEV.LOADLIB>,DISP=SHR
//S1 EXEC PGM=PRG1
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
1234 KRISHNA TNAGAR ADMIN ………….
/*
//
==================================================================

NOTE: You can also use the procedure IGYWCLG which can compile, link
and execute with a single JCL //GO.SYSIN DD * is to be used for giving
the input
ACCEPT thru’ SYSIN DD
ACCEPT statement reads a line from SYSIN DD * of RUNJCL and stores the
data in the variable. Data should be given in INTERNAL FORMAT

IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOPRG1.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NAME PIC X(10).
77 WS-NUM PIC 9(5).
PROCEDURE DIVISION.
ACCEPT WS-NAME.
DISPLAY WS-NAME.
ACCEPT WS-NUM.
DISPLAY WS-NUM.
STOP RUN.

IMPORTANT: INPUT DATA IS TO BE GIVEN THRU SYSIN DD * IN RUNJCL


Giving data thru SYSIN DD * is different from VALUE CLAUSE
For numeric item input should be given as: 00123 NOT AS 123
EXAMPLE
IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOEX01.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 NAME PIC X(15).
01 AGE PIC 9(2).

PROCEDURE DIVISION.

PARA-1.
ACCEPT NAME.
ACCEPT AGE.
DISPLAY “HELLO " NAME.
DISPLAY “YOUR AGE IS " AGE.
STOP RUN.
ACCEPT variable
FROM {DATE/TIME/DAY/DAY-OF-WEEK } [ YYYYMMDD ].

DISPLAY VAR1/LIT1 VAR2/LIT2 .. .. .. .. ..

DATE etc… are COBOL reserved data-items


ACCEPT can be followed by only one data-item
You have to use multiple display statements to show the contents on
separate lines

IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOPRG1.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 WS-NAME PIC X(10).

PROCEDURE DIVISION.
ACCEPT WS-NAME
DISPLAY “HALLO”
DISPLAY WS-NAME.
DISPLAY “HOW ARE YOU?”.
STOP RUN.
You have to use multiple display statements to show the contents on
separate lines

IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOPRG1.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUMB PIC 9(3)V9(3) VALUE 12.34.

PROCEDURE DIVISION.
ACCEPT NUMB
DISPLAY NUMB.
STOP RUN.
IMPORTANT:
THRU SYSIN DD * YOU HAVE TO GIVE INPUT AS 012340 WITHOUT DOT
ACCEPT can be used to capture system registers like DATE, TIME etc.

IDENTIFICATION DIVISION.
PROGRAM-ID. DEMODAT0.

DATA DIVISION.
WORKING-STORAGE SECTION.

77 WS-DATE PIC 9(8).

PROCEDURE DIVISION.

ACCEPT WS-DATE
FROM DATE YYYYMMDD.
DISPLAY WS-DATE.
STOP RUN.
ACCEPT variations

 ACCEPT WS-NAME

 ACCEPT WS-DATE FROM DATE

 ACCEPT WS-DATE FROM DATE YYYYMMDD


 .
 ACCEPT WS-TIME FROM TIME

 ACCEPT WS-DAY FROM DAY

 ACCEPT WS-DAY FROM DAY YYYYDDD

 ACCEPT WS-DWK FROM DAY-OF-WEEK


IDENTIFICATION DIVISION.
PROGRAM-ID. DEMODAT1.

DATA DIVISION.
WORKING-STORAGE SECTION.

77 WS-TIME PIC 9(8) VALUE 0.

PROCEDURE DIVISION.
ACCEPT WS-TIME FROM TIME.
DISPLAY WS-TIME.
STOP RUN.
IDENTIFICATION DIVISION.
PROGRAM-ID. DEMOWK01.

DATA DIVISION.
WORKING-STORAGE SECTION.

77 WS-DAY PIC 9(6) VALUE 0.

PROCEDURE DIVISION.

ACCEPT WS-DAY FROM DAY YYYYDDD.


DISPLAY WS-DAY.
ACCEPT WS-DWK FROM DAY-OF-WEEK
DISPLAY WS-DWK.
STOP RUN.

You might also like