Quick view of a database file structure

Quick view of a database file structure

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.

    By submitting your registration information to Search400.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of Search400.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.