Equivalence Data type entre RPG ile et SQL DB2
mer 27 février 2019Dans un billet précédent, j’ai donné les équivalences entre Rpg colonné et Free-form. Aujourd’hui, nous allons y ajouter une colonne avec les équivalences SQL DB2.
Data type |
Lettre ancienne forme |
Free-form syntax |
Examples |
SQL DB2 Data-type |
Alphanumeric | A | CHAR(len) VARCHAR(len {: varying-size} ) | DCL‑S library CHAR(10); DCL‑S libfilembr VARCHAR(33); DCL‑S cmdparm VARCHAR(10:4); | CHAR VARCHAR len>254 |
UCS‑2 | C | UCS2(len) VARUCS2(len {: varying-size} ) | DCL‑S firstName UCS2(10); DCL‑S filePath VARUCS2(5000); | GRAPHIC(len) with CCSID 13488 or CCSID 1200 VARGRAPHIC(len) with CCSID 13488 or CCSID 1200 |
Graphic | DBCS | GRAPH(len) VARGRAPH(len {: varying-size} | DCL‑S firstName GRAPH(20); DCL‑S fullName VARGRAPH(50); | GRAPHIC(len) VARGRAPHIC(len) |
Indicator | N | IND | DCL‑S isValid IND ; | |
Packed | P | PACKED(digits {:decimals} ) | DCL‑S numRecords PACKED(5); DCL‑S salary PACKED(15:2); | DECIMAL |
Zoned | S | ZONED(digits {: decimals} ) | DCL‑S numRecords ZONED(5); DCL‑S salary ZONED(15:2); | NUMERIC |
Binary | B | BINDEC(digits {: decimals} ) | DCL‑S numRecords BINDEC(9); DCL‑S bonus BINDEC(9:2); | SMALLINT(1<=digits<=4) INTEGER(5<=digits<=9) |
Integer | I | INT(digits) Digits can be 3, 5, 10, 20 | DCL‑S index INT(10); | SMALLINT digits=5
INTEGER digits=10 BIGINT digits=20 |
Unsigned | U | UNS(digits) Digits can be 3, 5, 10, 20 | DCL‑S count UNS(20); | |
Float | F | FLOAT(bytes) Bytes can be 4, 8 | DCL‑S variance FLOAT(8); | FLOAT |
Date | D | DATE { (format) } | DCL‑S duedate DATE ; DCL‑S displayDate DATE(*YMD); | DATE DATFMT(f) DATSEP(s)
Format =fs |
Time | T | TIME { (format) } | DCL‑S startTime TIME ; DCL‑S displayTime TIME(*USA); | TIME TIMFMT(f) TIMSEP(s)
Format =fs |
Timestamp | Z | TIMESTAMP | DCL‑S start TIMESTAMP ; | TIMESTAMP |
Pointer | * | POINTER | DCL‑S pUserspace POINTER ; | |
Procedure pointer | * | POINTER(*PROC) | DCL‑S pProc POINTER(*PROC); | |
Object | O | OBJECT{(*JAVA : class)} | DCL‑S obj OBJECT(*JAVA:‘Cls’); |