vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hello! I have to export several tables from informix to sdf text format (all fields must be specific length, numeric fields must be right justified and completed with 0 on the left, alphanumeric fields must be left justified and completed with spaces). Is it possible to format output using SELECT with some parameters? Mitja |
| |||
| Mitja Udovc wrote: > I have to export several tables from informix to sdf text format (all fields > must be specific length, numeric fields must be right justified and > completed with 0 on the left, alphanumeric fields must be left justified and > completed with spaces). What is SDF text format? Judging from the description, it is a fixed-width field layout - with or without delimiters on fields? What about record delimiters? Newline? What about escape conventions? What about variable length types (VARCHAR - and BYTE and TEXT and so on). > Is it possible to format output using SELECT with some parameters? No. For any of a variety of reasons - depending on your level of sophistication with DB-Access or ESQL/C programming. Consider using ACE from Informix-SQL. You might be able to batter SQLCMD into doing what you need (-F fixed). Not sure about the leading zeroes in SQLCMD - you could hack it easily enough (output.c, array fmt_f); you'd have to decide on how to integrate it smoothly into the program. -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/ |
| ||||
| "Mitja Udovc" <mitja.udovc@mf.uni-lj.si> writes: > I have to export several tables from informix to sdf text format (all fields > must be specific length, numeric fields must be right justified and > completed with 0 on the left, alphanumeric fields must be left justified and > completed with spaces). > > Is it possible to format output using SELECT with some parameters? No. You should probably just unload the tables from dbaccess and feed them to Perl scripts to do all that reformatting. If you don't know Perl, then this is an ideal project to start learning it with. It will pay off in spades for you if you have to do a lot of data reformatting like this. Another alternative might be to dump the tables to XML and use an XSLT processor to reformat the data... you, of course, will have to figure out how to dump the tables to XML (I don't even know if/how Informix J/Foundation can do that) and code the XSL script (which isn't nearly as pretty as a Perl script) and feed it all to Xalan. -- Forte International, P.O. Box 1412, Ridgecrest, CA 93556-1412 Ronald Cole <ronald@forte-intl.com> Phone: (760) 499-9142 President, CEO Fax: (760) 499-9152 My GPG fingerprint: C3AF 4BE9 BEA6 F1C2 B084 4A88 8851 E6C8 69E3 B00B |
| Thread Tools | |
| Display Modes | |
|
|