SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
C-110
Examples—CONVERT
SOURCEREC ORDER,
USESQLNULLS;
Note that the record definition has been altered by eliminating the DDL group
names and by creating a column for each elementary item in each group.
CONVERT makes these column names unique by appending 2 to the MONTH,
DAY, and YEAR columns derived from the DDL DELDATE group. You can change
these names by editing the file.
This command performs the conversion:
>> OBEY CNVSRC;
This example is the DDL record definition for the key-sequenced Enscribe file
called TSTKANJI and uses the Kanji data type:
RECORD kanji.
FILE IS "$vol1.subvol1.tstkanji" KEY-SEQUENCED.
02 A PIC N.
02 B PIC N VALUE IS N"aa".
02 C PIC N(4).
02 D PIC N(3) VALUE IS N"abcdef".
02 E PIC N(5) VALUE IS N"abcdefghij".
02 F PIC N(4) REDEFINES E.
02 G.
03 LEN PIC S9(4) COMP.
03 VAL PIC N(4).
KEY IS C DUPLICATES NOT ALLOWED.
END
This example creates an EDIT file named CNVSRC that contains the commands
needed to convert the DDL record definition to an SQL table:
>> CONVERT RECORD kanji TO TABLE $vol2.subvol2.kanjitbl;
Note that the CONVERT command does not include the REDEFINE clause, so F
in the DDL record definition is ignored and does not redefine E.
CNVSRC contains this CREATE TABLE command:
?SECTION CREATE_KANJITBL
CREATE TABLE \NODE.$VOL2.SUBVOL2.KANJITBL
(
A PIC X(2) NOT NULL , -- WARNING - PIC N
B PIC X(2) -- WARNING - PIC N
DEFAULT "aa" NOT NULL ,
--WARNING Default literal originally national language
string
C PIC X(8) NOT NULL , -- WARNING - PIC N
D PIC X(6) -- WARNING - PIC N
DEFAULT "abcdef" NOT NULL ,
--WARNING Default literal originally national language
string
E PIC X(10) -- WARNING - PIC N
DEFAULT "abcdefgh" NOT NULL ,
--WARNING Default literal originally national language