Thursday, 16 May 2013

Types of level in COBOL....

Level Numbers available are    

01-49      Group or elementary items
66           Renames clause
77           Independent elementary      data items
88           Condition names

77 level

 Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themselves.

Syntax:
77 VAL        PIC X(4).

88 level 

88 level is used for condition names.
The level 88 in the Data Division can be used to give condition names to the values that a field contains. A condition name entry specifies either a single value or a set of values for the condityional variable. When this level is specified you can use the condition name instead of is =equal to in the IF statement. Condition name should be specified under Level 88 immediately following the field description.
 
syntax:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 COND            PIC X.
     88 ACCEPT    VALUE 'Y'.
     88 REJECT     VALUE 'N'.   
 77 WS-VAL         PIC X.

PROCEDURE DIVISION.  
          ACCPET  WS-VAL.
          IF ( ACCEPT )
              PROCEED
          END-IF.
          IF ( REJECT )
              ROLL BACK
          END-IF. 
          STOP RUN.

01-49 LEVEL.

Used to describe a record.

Syntax:
01 INREC.
     02 ID          PIC X(3).
          03 P-ID             PIC X(3).

66 level. 

Renames clause
It is used for regrouping of elementary data items in a record. It should be declared at 66 level.

syntax:
01 WS-REC
        05 WS-NAME          PIC X(03).
        05 WS-VALUE         PIC X(04).
        66 ADD-NAME  RENAMES WS-NAME.


No comments:

Post a Comment

Expense Handler Application with advance technologies

Budget Planner  One of the application developed with Ionic 4 and Python-Flask.  Ionic 4 code:  https://github.com/logeshbuiltin/Expense...