COBOL programming,COBOL tutorials,COBOL training,COBOL Interview Questions, COBOL Jobs, COBOL Books, programming course, example programs,COBOL Syntax, COBOL Commands, COBOL Verbs and their usage, COBOL Jobs in Hyderabad, Chennai, Pune, Mumbai, Bangalore
Popular
-
IS NUMERIC is used to check if the data is numeric or not. IS NUMERIC clause IN COBOL EXAMPLE 01 WS-TEXT PIC X(05). MOV...
-
Level-66 Data-item is used for RENAMES Clause. RENAMES clause is used to regroup(Re-arrange), club together existing fields under a new name...
-
REDEFINES Clause IN COBOL Sometime two or more different variables defined in a program are not in use simultaneously. Their memory can b...
-
Almost all COBOL compilers treat a line of COBOL code as if it contained two distinct areas. These are - AREA A - Between Column 8 to 11 -Di...
-
SYNC Keyword is used in COBOL to align the data(storage-area) to a Word-Boundary(Any address which is a multiple of 4). This is because, on...
COBOL REDEFINES Clause IN COBOL Explanation With Example in COBOL
COBOL COMP SYNC - What is COMP SYNC in COBOL?
COBOL INDEX, COBOL Sub-script - What is the difference between Index and Sub-script?
For example,
01 WS-TABLE.
05 WS-NAME OCCURS 5 TIMES PIC X(10).
----------------------- Subscript Index -----------------------
0 0 1 10
2 20
3 30
.. ..
-----------------------
Since index is much more efficient, you should declare a table and Index it.
01 WS-TABLE.
05 WS-NAME OCCURS 5 TIMES PIC X(3) INDEXED BY I.
You use indexes just like subscripts, except for the fact that they are much faster and efficient.
PERFORM 1000-DISPLAY-DATA VARYING I FROM 1 BY 1 UNTIL I > 5
1000-DISPLAY-DATA.
DISPLAY WS-NAME(I).
To increment or decrement an Index, SET Verb is used. SET I UP BY WS-LIT-ONE.
SET I TO 1.
You cannot MOVE data to Indexes. You also cannot perform Arithmetic Operations on an Index.
IS NUMERIC clause IN COBOL IS NUMERIC CLAUSE
IS NUMERIC clause IN COBOL EXAMPLE
01 WS-TEXT PIC X(05).
MOVE '15623' TO WS-TEXT.
IF WS-TEXT IS NUMERIC DISPLAY 'NUMBER'
ELSE
DISPLAY 'TEXTUAL CHARACTERS’
END-IF.
Output:
NUMBER
MOVE 'HE123' TO WS-TEXT
IF WS-TEXT IS NUMERIC DISPLAY 'NUMBER'
ELSE
DISPLAY 'TEXTUAL CHARACTERS’
END-IF.
Output:
TEXTUAL CHARACTERS
COBOL PICTURE Clauses COBOL Picture Clause Usage Descriptions
- PIC 9(6) is equivalent to PICTURE 999999
- PIC 9(6)V99 is equivalent to PIC 999999V99
- PICTURE X(10) is equivalent to PIC XXXXXXXXXX
- PIC S9(4)V9(4) is equivalent to PIC S9999V9999
- PIC 9(18) is equivalent to PIC 999999999999999999
How do you define a table or array in COBOL?
01 CONTACT-RELIST.
05 CONTACT-RECORDs OCCURS 5 TIMES.
10 NAME PIC X(10).
10 PHONE PIC 9(08).
LEVEL 66 In COBOL : What is level 66 used for ?
Level-66 Data-item is used for RENAMES Clause. RENAMES clause is used to regroup(Re-arrange), club together existing fields under a new name.
01 RECORDS.
05 GROUP-A.
10 FIELD-1 PIC 9(02).
10 FIELD-2 PIC 9(02).
05 GROUP-B.
10 FIELD-3 PIC 9(02).
10 FIELD-4 PIC 9(02).
66 GROUP-C RENAMES FIELD-2 THRU FIELD-3.
HIGH-VALUES Clause in COBOL And LOW-VALUES Clause in COBOL - What are HIGH-VALUES and LOW-VALUES in COBOL?
INDEX in COBOL : How to Define INDEX in Working-Storage Section ?
EXIT PROGRAM Clause in COBOL
GO BACK Clause in COBOL
STOP RUN Clause in Cobol
What is the difference between STOP RUN, GO BACK and EXIT PROGRAM?
Can you pass an Index to another COBOL Program, via LINKAGE SECTION?
No, an INDEX is not a Working-storage area. It is maintained by the System. You can only send the data which is in Working-storage areas(Rough-work area) or in File Input-Output Areas to a COBOL Program.
You can pass a Subscript to another COBOL Program.
88-Level In Cobol : What is 88-Level used for?
Used for assigning labels to data-values that a COBOL-Variable can take. Very useful in detecting special-conditions. They work like flags or switches.
01 TEMPERATURE PIC 9(03).
88 HIGH-TEMPERATURE VALUES 75 THRU 100.
88 MEDIUM-TEMPERATURE VALUES 50 THRU 74.
88 LOW-TEMPERATURE VALUES 32 THRU 49.
MOVE 60 TO TEMPERATURE
IF MEDIUM-TEMPERATURE(You need not write TEMPERATURE=60)
...
END-IF