Sie sind auf Seite 1von 4

2.

DATA TYPES
========================================
1.ELEMENTARY DATA TYPES 1.PRE-DEFINED DATA TYPES : N,C,I,P,F,X,D,T,STRING
2.USER-DEFINED DATA TYPES : TYPES (KEYWORD)
2.STRUCTURED DATA TYPES 1.PRE-DEFINED DATA TYPES: TABLES (KEYWORD)
2.USER-DEFINED DATA TYPE: INTERNAL TABLES
DATA OBJECTS : VARIABLES: THEY CHANGE THEIR VALUE DURING RUNTIME/EXECUTION TIME.
EX: A
A IS ONE CHARACTER BY DEFAULT.
DATA TYPE: WHAT TYPE OF DATA, DATA OBJECT IS GOING TO STORE IN IT IS KNOWN AS DA
TA TYPE
A
I (INTEGER IS DATA TYPE)
DATA: KEYWORD TO DEFINE DATA OBJECTS
SYNTAX:
DATA <DATA OBJECT NAME> TYPE <PRE-DEFINED DATA TYPE>.
DATA: <DATA OBJECT NAME> LIKE <EXISTING DATA OBJECT>.
EX: DATA: A TYPE I.
DATA: B LIKE A.
EX: DATA: CNO LIKE KNA1-KUNNR.
KNA1: CUSTOMER TABLE, KUNNR : CUSTOMER NUMBER
CONSTANTS: HAS FIXED VALUE
EX: CONSTANTS : A = 20.

=======================================================
1.ELEMENTARY DATA TYPES 1.PRE-DEFINED DATA TYPES : N,C,I,P,F,X,D,T,STRING
================================================================
n: numeric : (0-9) digits. it is not used for calculations. it is used to repres
ent sequence of numbers such as
empno, vendno, matno etc.,
ex: '1000', 1000.
c: character (a-z, alphanumeric a333) default data type is allways a character
'ravi'.
i: integer (-3,-2,-1,0,1,2,3,,,) no-decimals. it is used for calculations.
p: packed decimals : keyword : decimals . max decimals : 14
data: numb type p decimals 2.
f: float : exponential result is displayed with the float. '0.0000000000000000+e
01'
it is not used to give input to any program
x: hexa decimals: binary nos, system nos

d: date : yyyy mm dd ( 8chars)


t: time: hh mm ss
string : ' '
==========================================================================
*n,c data types
data : numb type n,
name type c.
numb = '1000'.
name = 'ravi krishna'.
write:/ numb, name.
=================================
result: 0 r
=====================================
*n,c data types
data : numb(4) type n,
name(30) type c.
numb = '1000'.
name = 'ravi krishna'.
write:/ numb, name.
result: 1000 ravi krishna
==========================================
*n,c data types
data : numb(4) type n,
name(30) type c.
move '1000' to numb.
move 'ravi krishna' to name.
write:/ numb, name.
result: 1000 ravi krishna
==========================================
*prg for i data type
data: a type i,
b type i,
c type i.
a = 60.
b = 70.
c = a + b.

write:/ c.
===========================================
parameters : is a keyword to give input values at the runtime
*prg using i data type
parameters: a type i,
b type i.
data: c type i.
c = a + b.
write:/ c.
======================================================
*prg using packed decimals
data: num type p decimals 2 value '4.11',
den type p decimals 2 value '1.11',
res type p decimals 14
.
res = num / den.
write:/ res.

"it gives exact division

res = num div den.


write:/ res.
"it gives quantant
res = num mod den.
write:/ res.
"it gives reminder
============================================================
*prg using packed decimals
data: num type p decimals 2 value '4.11',
den type p decimals 2 value '1.11',
res type p decimals 14
.
res = num / den.
write:/ res.

"it gives exact division

res = num div den.


write:/ res.
"it gives quantant
res = num mod den.
write:/ res.
"it gives reminder
===============================================
assignment
1.create a program using parameters and using packed decimals
2.suppose the result of a program is 5.7896
make the result in 2 decimals
5.79 (rouding the result)
5.78 which is correct result

==================================================================
next class: structure data objects, types, type-pools
==================================================================

Das könnte Ihnen auch gefallen