From the course: COBOL Essential Training
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Using the string command in COBOL - COBOL Tutorial
From the course: COBOL Essential Training
Using the string command in COBOL
- [Instructor] When working with alphanumeric fields in COBOL, it often is necessary to be able to combine some of the strings together. The string verb is used to combine strings and this is also called String Concatenation. In this program, we're reading a sequential file that again, contains a list of employees with their last name, first name and middle initial. Let's take a quick look at the file. You can see here the last name is right after the CO security number followed by the first name followed by the middle initial. Let's go back over to our COBOL program. Using the string statement, we will format the name to be displayed as the first name followed by a space followed by the middle initial followed by a single space followed by the last name. So to eliminate any extra spaces in the employee's name, we will also use the optional delimited by space to allow us to only get the name and not all the extra spaces that…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.