This command is useful to see the summary of fields of a database file. You can see all information related to a field, and this needs only one line per field. This is a very compact view of a database file in a green screen.
Command syntax: FD |[libary name]/|[file name]
If you put only the file name, the library name is searched for on current library list.
You need the following object in library QGPL: FD *QMQRY FD *PGM FD *CMD The output is derived from a system file QADBIFLD in QSYS library.
=======================================
Create a Query manager query (use STRQM command):
SELECT
DBIFLD,
DECIMAL(DBICLN,4,0) AS CLENGTH,
DBINLN AS NLENGTH, DBINSC AS NSCALE,
SUBSTR(DBITXT,1,30) AS FTEXT, DBIITP,
DBIILN, DBITYP, DBIPOS
FROM QADBIFLD
WHERE DBILIB= &LIB and DBIFIL= &FILE
=======================================
Create a CL program to utilize the query above:
PGM PARM(&QNAME)
DCL &FILE *CHAR 10
DCL &LIB *CHAR 10
DCL &QNAME *CHAR 20
DCL &FILEC *CHAR 12
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts including news, tips, and advice to help you do your job more efficiently and effectively. Stay informed on the hottest topics and biggest challenges faced by IT professionals working with iSeries products and services.
DCL &LIBC *CHAR 12
CHGVAR &FILE %SST(&QNAME 1 10)
CHGVAR &LIB %SST(&QNAME 11 10)
CHKOBJ OBJ(&LIB/&FILE) OBJTYPE(*FILE) MBR(*FIRST)
MONMSG MSGID(CPF9801 CPF9810) EXEC(GOTO CMDLBL(END))
IF COND(&LIB = '*LIBL') THEN(RTVMBRD +
FILE(&FILE) RTNLIB(&LIB))
CHGVAR &FILEC (''''||&FILE||'''')
CHGVAR &LIBC (''''||&LIB||'''')
STRQMQRY QMQRY(*LIBL/FD) SETVAR((LIB &LIBC) +
(FILE &FILEC))
END:
ENDPGM
=======================================
Create a command to call the CL program above:
CMD PROMPT('File Description Query')
PARM KWD(FILE) TYPE(NAME1) MIN(1) CHOICE('Name')
PROMPT('File')
NAME1: QUAL TYPE(*NAME) LEN(10) MIN(1)
QUAL TYPE(*NAME) LEN(10) DFT(*LIBL) +
SPCVAL((*LIBL))
This was first published in August 2001