Getting member information into a database file
You can get member information into a database file using DSPFD. Example:
DSPFD FILE(QCLSRC) TYPE(*MBRLIST) OUTPUT(*OUTFILE) OUTFILE(QTEMP/LISTFILE)
This creates LISTFILE in QTEMP, or, if it already exists, replaces the previous contents. The file will contain one record for each member in QCLSRC. The record format has the following structure (I have marked the fields you are most interested in with *) :
Format QWHFDML "DSPFD format for TYPE *MBRLIST" 1 1 1A MLRCEN Retrieval century: 0=19xx, 1=20xx 2 7 6A MLRDAT Retrieval date: year/month/day 8 13 6A MLRTIM Retrieval time: hour/minute/second 14 23 10A MLFILE File 24 33 10A MLLIB Library 34 34 1A MLFTYP P=PF, L=LF, R=DDM PF, S=DDM LF 35 38 4A MLFILA File attribute: *PHY or *LGL 39 41 3A MLMXD Reserved 42 47 6A MLFATR File attribute: PF, LF, PF38, or LF38 48 55 8A MLSYSN System Name (Source System, if file is DDM) 56 57 3,0P MLASP Auxiliary storage pool ID: 1=System ASP 58 61 4A MLRES Reserved 62 64 5,0P MLNOMB Number of members * 65 74 10A MLNAME Member * 75 80 10,0P MLNRCD Current number of records 81 86 10,0P MLNDTR Number of deleted records 87 92 10,0P MLSIZE Data space and index size in bytes, -1=See MLSIZ2 93 96 4A MLSEU Source type for S/38 View as it appeared on S/38 97 97 1A MLCCEN Member creation century: 0=19xx, 1=20xx 98 103 6A MLCDAT Member creation date: year/month/day 104 104 1A MLCHGC Last change century: 0=19xx, 1=20xx 105 110 6A MLCHGD Last change date: year/month/day 111 116 6A MLCHGT Last change time: hour/minute/second * 117 166 50A MLMTXT Text 'description' * 167 176 10A MLSEU2 Source type 177 177 1A MLUCEN Last Used Century: 0=19xx, 1=20xx 178 183 6A MLUDAT Last Used Date: year/month/day 184 186 5,0P MLUCNT Days Used Count 187 187 1A MLTCEN Usage Data Reset Century: 0=19xx, 1=20xx 188 193 6A MLTDAT Usage Data Reset Date: year/month/day 194 201 15,0P MLSIZ2 Data space and index size in bytes 202 202 1A MLSTFR Member storage freed Y=Yes (NOTE: This is in V5R2 of OS/400 -- the fields may be different at other operating system levels.) You can now use a CL or RPG program to read this member list and do what you want with the information. To open a source member in a program, use OVRDBF to override the program name of the file (MYSRC, for example) to the actual name & library of the source file, and the MBR parameter will be the name of the member you want to open. Declare the file in your F-specs as PROGRAM DESCRIBED, not externally described. The record length can be greater than the actual length you expect (remember that ILE source files have record lengths of 112 bytes). Create I-specs to describe the fields as follows: 1 6 6,2S SRCSEQ (Source sequence number) 7 12 6,0S SRCDAT (Source change date) 13 112 100A SRCDTA (Source line)
==================================
MORE INFORMATION ON THIS TOPIC
==================================
The Best Web Links: tips, tutorials and more.
Visit the ITKnowledge Exchange and get answers to your developing questions fast.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.