3. Embedded SQL for COBOL : COBOL Data Items and Data Types : Data Types : Alphabetic, Alphanumeric, and Alphanumeric Edited Categories
 
Share this page                  
Alphabetic, Alphanumeric, and Alphanumeric Edited Categories
Embedded SQL accepts data declarations in the alphabetic, alphanumeric, and alphanumeric edited categories. The syntax for declaring data items in those categories is:
level-number data-name PIC [IS] pic-string
[[USAGE [IS]] DISPLAY].
Syntax: The pic-string can be any legal COBOL picture string for the alphabetic, alphanumeric, and alphanumeric edited classes. Embedded SQL notes only the length of the data item and that the data item is in the alphanumeric class.
You can use alphabetic, alphanumeric, and alphanumeric edited data items with any Ingres object of character (char or varchar) type. You can also use them to replace names of certain objects if the particular embedded SQL statement allows dynamic specification of object names. Note, however, that, when a value is transferred into a data item from an Ingres object, it is copied directly into the variable storage area without regard to the COBOL special insertion rules.
When data in the database is in a different format from the alphanumeric edited picture, you must provide an extra variable to receive the data. You can then MOVE the data into the alphanumeric edited variable. However, if data in the database is in the same format as the alphanumeric edited picture (which would be the case, for example, if you had inserted data using the same variable you are retrieving into), you can assign the data directly into the edited data item, without any need for the extra variable. For more information on type conversion, see Data Type Conversion in this chapter.
The following example illustrates the syntax for these categories:
01 ENAME      PIC X(20).
01 EMP-CODE   PIC xx/99/00.