3. Embedded SQL for COBOL : Embedded SQL Statement Syntax for COBOL : String Literals
 
Share this page                  
String Literals
Single quotes (') delimit embedded SQL string literals. To embed a single quote in a string literal, use two single quotes, as follows:
EXEC SQL INSERT
      INTO employee (ename)
      VALUES ('Edward ''Ted'' Smith')
      END-EXEC.
You can continue string literals over multiple lines. Following COBOL rules, if the continued line ends without a closing quotation mark, the continuation line must contain a hyphen (-) in the indicator area. The first non‑blank character after the hyphen must be a single quotation mark, followed by the continued string as follows:
EXEC SQL UPDATE employee
      SET comments = 'Completed all projects on time.
-  ' Recommended for promotion.'
      WHERE name = 'Jones'
      END-EXEC.
VMS:
As discussed earlier, the indicator area is either column 1 or column 7, depending on whether the format you are using is VAX terminal or ANSI.
In the context of a declare section, use double quotes to delimit strings in compliance with the syntax rules of the COBOL compiler.
01 dbname PIC X(20) VALUE "personnel".