Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c....

27
Ultimo aggiornamento: 04/03/2021 Marco Riva www.markonetools.it Esplorare il DB2 definizioni file & c.

Transcript of Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c....

Page 1: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Ultimo aggiornamento: 04/03/2021

Marco Riva

www.markonetools.it

Esplorare il DB2

definizioni file & c.

Page 2: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

IBM iSQL

Oggetti del DB2

Power coffee - MK1

2

schema/collection

table

view

index

row

column

log

library

physical file

logical file (no key)

keyed logical file

record

field

journal

Page 3: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Metodi per esplorare il DB2

DSPFD / DSPFFD (Display File Field Description)

IBM ACS Gestione schemi

catalogo del DB2

RDi

DBeaver (https://dbeaver.io/)

Squirrel SQL client (http://squirrel-sql.sourceforge.net/)

JCRFD (http://www.jcrcmds.com/jcrdown2.html#JCRFD_tag)

iView (https://rpg-language.com/iview.html)

. . .

Power coffee - MK1

3

Page 4: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

DSPFFD

comando standard del sistema operativoDSPFFD FILE(DB2SAMPLE/EMPLOYEE)

output a video, su stampa o su file di output

Power coffee - MK1

4

Page 5: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi

Power coffee - MK1

5

scelta schemi(=librerie) da visualizzare dal menu Modifica > Includi

Page 6: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi – tabelle (file fisici)

Power coffee - MK1

6

Page 7: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi – indici (file logici)

Power coffee - MK1

7

Page 8: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi – viste (file logici)

Power coffee - MK1

8

Page 9: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi – relazioni db (indici)

Power coffee - MK1

9

Page 10: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

ACS - Gestione schemi – relazioni db (tutti)

Power coffee - MK1

10

Page 11: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Catalogo del DB2 - tabellaselect ORDINAL_POSITION as "Ord.",

SYSTEM_COLUMN_NAME as "Col.sist.", COLUMN_NAME as "Col.",

DATA_type as "Tipo", sum(STORAGE) over(partition by 1 order

by ORDINAL_POSITION) - STORAGE + 1 as "Pos.",

LENGTH as "Lungh.", NUMERIC_SCALE as "Dec.",

COLUMN_TEXT as "Descrizione (testo)",

COLUMN_HEADING as "Descrizione"

from SYSCOLUMNS

where TABLE_SCHEMA = 'DB2SAMPLE'

and TABLE_NAME = 'EMPLOYEE'

order by ORDINAL_POSITION;

Power coffee - MK1

11

https://www.markonetools.it/sql-pret-a-porter/#catalogo%20DB2

Page 12: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Catalogo del DB2 - tabella

select ORDINAL_POSITION "Ord.", SYSTEM_COLUMN_NAME "Col.sist.",

COLUMN_NAME "Col.", DATA_TYPE "Tipo", DDS_TYPE "Tipo (DDS)",

DATA_TYPE_LENGTH "Lungh.", NUMERIC_SCALE "Dec.",

COLUMN_TEXT "Descrizione (testo)",

COLUMN_HEADING "Descrizione«

from table(QSQSYSCOL2(char('DB2SAMPLE', 10),

char('EMPLOYEE', 10))) as DefFile;

Power coffee - MK1

12

Page 13: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Catalogo del DB2 - indice

select ORDINAL_POSITION "Ord.", COLUMN_NAME "Chiave",

SYSTEM_COLUMN_NAME "Chiave (nome sis.)", ORDERING "Asc/Desc«

from SYSKEYS

where SYS_IDNAME = 'DB2SAMPLE' and SYS_IXNAME = 'EMPLO01L‘

order by ORDINAL_POSITION;

Power coffee - MK1

13

Page 14: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Catalogo del DB2 – relazioni DB (indici)

select INDEX_NAME "Nome", SYSTEM_INDEX_NAME "Nome sistema",

IS_UNIQUE "Univoco", COLUMN_COUNT "N.chiavi",

INDEX_TEXT "Descrizione", SEARCH_CONDITION "Cond.where"

from SYSINDEXES

where SYSTEM_INDEX_SCHEMA = 'DB2SAMPLE‘

and SYSTEM_TABLE_NAME = 'EMPLOYEE';

Power coffee - MK1

14

Page 15: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Rational Developer for i (RDi) Dalla vista tabella Oggetti, clic destro su un oggetto Tabella

Power coffee - MK1

15

Page 16: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Rational Developer for i (RDi)

oppure dall’editor LPEX posizionandosi su un nome di file nella specifica F

Power coffee - MK1

16

Page 17: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

DBeaver

Power coffee - MK1

17

Page 18: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Squirrel SQL client – area object

Power coffee - MK1

18

Page 19: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

Squirrel SQL client – grafico

Power coffee - MK1

19

Page 20: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

JCRFD

Craig Rutledge - Open Source iSeries Tools (JCRCMDS)L’elenco completo dei tools è visualizzabile sul sito http://www.jcrcmds.com/.

Visualizza informazioni sul file: formati record, membri, elenco campi, relazioni, campi chiave e regole selezione/omissione, trigger

Power coffee - MK1

20

Page 21: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

JCRFD - esempio JCRFD FILE(DB2SAMPLE/EMPLOYEE)

output a video e stampa

Power coffee - MK1

21

Page 22: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

iView

https://rpg-language.com/iview.html

IVIEW is a drilldown program for IBM i. It enables a user to start at the highest library level - QSYS - and drill down to view the fields on a given file in any library. In this way, it integrates commands such as DSPLIB, DSPOBJD, DSPFD and DSPFFD.

Output is green-screen

Target release is V5R3 and later

Power coffee - MK1

22

Page 23: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

iView - esempio

IVIEW LIBOBJ(DB2SAMPLE/EMPLOYEE)

Power coffee - MK1

23

Page 24: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

iView - esempio

Power coffee - MK1

24

Page 25: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

iView - esempio

Power coffee - MK1

25

Page 26: Esplorare il DB2 definizioni file & c. · 2021. 3. 4. · Esplorare il DB2 definizioni file & c. SQL IBM i Oggetti del DB2 Power coffee - MK1 2 schema/collection table view index

iView - esempio

Power coffee - MK1

26