Beruflich Dokumente
Kultur Dokumente
String
identifier-1
literal-1
Delimited by
Delimited by
Into identifier-7
identifier-3
literal-3
size
identifier-2
literal-2
identifier-4
literal-4
identifier-6
literal-6
size
; on overflow imperative-statement
identifier-5
literal-5
Example
Let us consider the following Data Division entries
77
77
77
77
FIELD-1
FIELD-2
FIELD-3
DATA
PIC
PIC
PIC
PIC
X(4)
X(6)
X(9)
X(14)
VALUE
VALUE
VALUE
VALUE
ABCD.
MA IN.
121,34,56.
SPACES .
The statement is
STRING FIELD-1, FIELD-2, FIELD-3 DELIMITED BY
, , INTO DATA.
INSPECT verb
The INSPECT verb enables the programmer
to tally and/or replace the occurrences of a single
character or groups of characters in a data field.
INSPECT
identifier-1
identifier-2
TALLYING
FOR
,
ALL
LEADING
CHRACTERS
BEFORE
INITIAL
AFTER
identifier-4
literal-2
identifier-3
literal-1
Example
Let us consider the following Data Division entries
77
FIELD-1
77
DATA
PIC
PIC
X(20) VALUE
ANANTAKUMARMAITY.
X(2).
The statement Is
INSPECT
FIELD-1
TALLYING
DATA
FOR
ALL A .
INSPECT
CHARACTERS
identifier-1
BY
ALL
LEADING
FIRST
identifier-2
literal-1
identifier-4
literal-3
BEFORE
REPLACING
BEFORE
AFTER
BY
identifier-3
literal-2
identifier-5
literal-4
identifier-6
INITIAL
AFTER
INITIAL
..
literal-5
Example
Let us consider the following Data Division entries
77
FIELD-1
77
DATA
PIC
PIC
X(20) VALUE
ANANTAKUMARMAITY.
X(2).
The statement Is
INSPECT
FIELD-1
REPLACING
ALL
BY
..
INSPECT
identifier-1
TO
CONVERTING
identifier -3
literal-2
identifier-2
literal-1
UNSTRING Verb
- It splits larger string to smaller parts or
sub-strings .
UNSTRING
identifier-1
DELIMITED BY [ ALL ]
identifier-2
, OR [ ALL ]
identifier-3
literal-1
INTO
literal-2
Example
Let us consider the following Data Division entries
77
77
77
77
FIELD-1
FIELD-2
FIELD-3
DATA
PIC
PIC
PIC
PIC
X(5).
X(5).
X(5).
X(15) VALUE IS
ABCDEFGCCHIJKCL.
The statement is
UNSTRING DATA DELIMITED BY C
INTO FIELD-1, FILED-2, FIELD-3.
Reference Modification
It is similar to unstring.
The general syntax is ,
Example
Let us consider the following data description entry
05 DATA-FIELD PIC X(11) VALUE MATHEMATICS
05 OLD-FIELD
PIC X(05).
Now the statement
MOVE
DATA-FIELD (4 : 2) TO OLD-FIELD.
COPY
verb
COPY
text-name
REPLACING
OF
IN
= = pseudo-text-1 = =
identifier-1
literal-1
word-1
= = pseudo-text-3 = =
identifier-3
literal-3
word-3
library-name
BY
BY
= = pseudo-text-2 = =
identifier-2
literal -2
word-2
= = pseudo-text-4 = =
identifier-4
literal-4
word-4
Example
Let TEXT be the name of the following text in the library file.
RECORD CONTAINS 130 CHARACTERS
BLOCK CONTAINS 10 RECORDS
LABLE RECORDS ARE STANDARD
VALUE OF ID IS FILE.
Now the following code
FD FILE-MASTER
COPY TEXT.
At the time of compilation , it will become
FD FILE-MASTER
RECORD CONTAINS 130 CHARACTERS
BLOCK CONTAINS 10 RECORDS
LABLE RECORDS ARE STANDARD
VALUE OF ID IS FILE.
INITIALIZE
verb
Used for Setting Numeric Fields to Zeroes and NonNumeric Fields to Spaces.
INITIALIZE { identifier-1 } .
REPLACING
DATA
BY
ALPHABETIC
ALPHANUMERIC
NUMERIC
ALPHANUMERIC-EDITED
NUMERIC-EDITED
identifier -2
literal-1
Example
Let us consider the following Data Division entries
01
A.
02
02
02
B
C
D
PIC
PIC
PIC
A(2).
X(2).
9(2).
The statement is
INITIALIZE A REPLACING
ALPHABETIC DATA BY NO
ALPHANUMERIC DATA BY N
NUMERIC DATA BY 0.
REDEFINES
Clause
Example
01 CUSTOMER-RECORD.
05 CUST-NO
PIC 999.
05 CUST-NAME PIC X(15).
05 CUST-TEL-NO
PIC 9(7).
01 SALES-RECORD REDEFINES
CUSTOMER-RECORD.
EVALUATE Verb
- It depicts the CASE structure.
identifier-1
literal-1
arithmetic-expr-1
THROUGH
THRU
identifier-2
literal-2
arithmetic-expr-2
Example
EVALUATE TRUE
WHEN MONTH = 4 OR 6 OR 9 OR 11
MOVE 30 TO NO-OF-DAYS
WHEN MONTH = 2
MOVE 28 TO NO-OF-DAYS
WHEN OTHER MOVE 31 TO NO-OF-DAYS
END-EVALUATE.
Thank You