FALSE

Page Nav

HIDE

Grid

GRID_STYLE

Data Types used in COBOL

Data Types       1.      What are the different data types available in COBOL? Numeric, Alphabetic (A) , Alpha-numeric (X) and , Numeric (9...

Data Types

     1.     What are the different data types available in COBOL?
Numeric,
Alphabetic (A),
Alpha-numeric (X) and,
Numeric (9).
Numeric Edited and
Alphanumeric Edited.

Symbols used
Numeric                      9 P S V
Alphabetic                   A       
Alphanumeric               X 9 A
Numeric Edited             9 P V and at least one of the editing symbols
                                 B / Z 0 + - * , . CR DB $
Alphanumeric Edited      X 9 A B 0 /

Example:.g.,
 77         WS-MESSAGE          PIC X(30).
 77         WS-NUMBER            PIC 9999.
     2.     What are the permissible character sets in COBOL?
Digits                0,1,2…9        
Letters              A,B,…Z         
Space/Blank       Bb               
Special Symbols +  -   *  /      (  )   $ . “      <   >   =
     3.     What are all the figurative constants available in COBOL?
Zero, Zeroes, Zeros
Quote, Quotes
Space, Spaces
High-Value, Highest-Value
Low-Value, Lowest-Value
All

     4.     What are all the possible Editing Characters used in COBOL. Explain them with examples?
Numeric Data
    Z                 Zero Suppression
    *                  Asterisk
    $                  Currency Sign
    -                  Minus Sign
    +                 Plus  Sign
    CR DB           Credit  Debit  Sign
    Period           (.)
    Comma                   (,)
    Blank            (‘b’)
    Zero             (0) 
    Slash            (/)
    Blank  When  Zero
       Inserts blanks when data value is zero
Alpha Numeric Data
    Blank, Zero,   Slash Insertion

Note:
Mutually Exclusive PIC Clauses
    CR and DB
    $ + _  Z *
    V .

Example:.g.,

PIC                  Numeric Edited
                        Value              Value
ZZZV99             38^4            b3840
* * 999            00052           * * 052
$ * *999           985              $**985
-ZZZV99           -46^52         -b4652
+999                -382             -382
+999                382              +382
9999+              -382             0382-
ZZ,Z99             2456             b2,456
ZZZZ.ZZ           0^05            bbbb.05
$$$$9.99          342              b$342.00
99B99B99          46               00b00b46
09990              456              04560
999/999/99        3254            000/032/54

     5.     What is the difference between PIC 9.99 and 9v99?
PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE-POSITION numeric field with implied or assumed decimal position.
     6.     What is PIC 9v99 Indicates?
PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position; the v means an implied decimal point.
     7.     Can JUSTIFIED be used for all the data types?
No, it can be used only with alphabetic and alphanumeric data types.

No comments