HP DDL D40 Reference Manual page 154

Data definition language
Table of Contents

Advertisement

Definition Attributes
If the TYPE clauses in the ORDERINFO definition were replaced by the structures they
represent, the definition would look like this:
DEF
orderinfo.
02 employee.
03 last-name
03 first-name PIC X(20).
02 ordernum
02 orderdt
02 orderint
02 delivdate TYPE SQL DATE
02 salesman
02 custnum
END
The definition ORDERNUM, referenced by TYPE *, keeps its name in the
ORDERINFO record, but its implicit level 01 is changed to 02, and a new heading
overrides its original heading.
New headings specified for ORDERNUM, ORDERDT, and DELIVDATE override the
heading declared in ORDDATE and DELDATE.
SQL VARCHAR Field Output for C. The following examples show how DDL
translates definitions and descriptions of SQL VARCHAR fields into C source code:
DDL Type
DEF name
TYPE SQL VARCHAR 25
VALUE "Mary"
DEF customer.
02 customer-name TYPE name.
02 address
END.
Data Definition Language (DDL) Reference Manual—426798-002
PIC X(10).
PIC
9(3)
TYPE SQL DATETIME YEAR TO DAY
TYPE SQL INTERVAL MONTH 2
PIC 9(4)
PIC 9(4)
TYPE SQL VARCHAR 29
OCCURS 10 TIMES
6- 60
HEADING "Order
HEADING "Order
HEADING "Order
HEADING "Deliv
HEADING "Salesman
HEADING "Customer
C Type
#pragma fieldaligh shared2 __name
typedef struct __name
{
short
len;
char
val[25];
} name_def;
/*value is "Mary"*/
#pragma fieldalign shared2 __cust
typedef struct __cust
{
name_def
customer_name;
/*value is "Mary"*/
struct {
short
len;
char
val[29];
} address[10];
} customer_def
TYPE Clause
Number".
Date".
Interval".
Date".
#".
#".

Advertisement

Table of Contents
loading

Table of Contents