To efficiently read the data, you predefine a format that contains all fields. However, you rename each field to Fnnnn on retrieval. This prevents any clashes with the control fields, if, for example, the database contains a field called I. You also ask that null fields not be returned, to save processing overheads.
You then loop through the vartable built previously, to build a format using START/DATA/END:
&I = 1
&NDBFMT &DBNAME DEFINE FORMAT=UFMT START &NDBFMT &DBNAME DATA FIELDS &DOWHILE &I LE &FNUM &VARTABLE GET ID=FTAB KEY=I FIELDS=DATA VARS=FNAME &NDBFMT &DBNAME DATA (F&I = &FNAME NULLFIELD=NORETURN) &I = &I + 1 &LOOPCTL 1000 &DOEND &NDBFMT &DBNAME END
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |