I am coming back after a little hectic work. Just sitting relaxed and reading the book “How the Rich think“. I just started writing my blog post, got an idea to write strings.
The fact is in COBOL, strings is an important concept. You may use it in many places viz: during dynamic SQL queries, concatenating names, error handling etc.
Usage 1:
01 Final_name pic x(8) value "testname". String "18" Delimited by Size into Final-name End-String
In this case the initialized value will be modified . So the new name is “18stname”.
Usage 2:
String "My name is srinimf" Delimited by Size Into New-name End-string
In this case, the complete string moved into a new variable
Usage 3:
01 City pic x(3) value "New city" String City Delimited by ' ' Into New-city-name End-string
In this case, only upto first space will be moved into new name.
Usage 4:
o1 ws-cnt pic 99. Move 1 to ws-cnt. String "My name is srinimf" Delimited by Size Into New-name with Pointer ws-cnt End-String
In this case, the ws-cnt will have the number of chars (ws-cnt -1) that finally moved.