skip to main content

Procedure Division Statements : STRING

STRING
General Format
STRING { { Identifier-1 } ... [ DELIMITED BY { [TRAILING] {Identifier-2} } ] } ... 
  INTO Identifier-3
  [ WITH POINTER Identifier-4 ] 
  [ ON OVERFLOW Imperative-Statement-1 ] 
  [ NOT ON OVERFLOW Imperative-Statement-2 ] 
  [END-STRING]
Syntax rules
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
General rules
1.
2.
3.
A.
B.
C.
 
This behavior is repeated until all occurrences of literal-1 or data items referenced by identifier-1 have been processed.
4.
5.
6.
7.
8.
A.
B.
C.
D.
9.
10.
Examples
Concatenating 3 variables discarding trailing spaces
initialize str-result
string str-1 delimited by trailing spaces
       str-2 delimited by trailing spaces
  into str-result
Concatenating variables and literals delimited by size and including new lines, validating overflow
initialize cust-data
string "Customer Name : " cust-last-name ", " cust-first-name x"0d0a"
       "Customer Age  : " cust-age x"0d0a"
       "Customer Address : " cust-address
  into cust-data
    on overflow display message "Customer data is too large!"
Using pointer to indicate where to start concatenating
initialize my-str
move 1 to idx
string "hello " "world!" into my-str pointer idx
move 25 to idx
string "good bye!" into my-str pointer idx
move 35 to idx
string "hi again!" into my-str pointer idx

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left