Re: How to read Flat files from 4gl
Posted in 1995
In article <3p8018$2sj@apollo.jcpenney.com>, jschumac@uns-dv1 (Joel Schumacher) writes:
|> habibollah valanejad (vala@netcom.com) wrote:
|> : billy.wheeler@digitec.co.za (Billy Wheeler) writes:
|>
|> : >-> I have a requirment to read the flat file from 4GL. Is there any way
|> : >-> to do it.
|>
|> : >Well, if it's a delimited file, you can use the LOAD statement or you
|> : > can RUN a dbload and then read it as a table.
|>
|> : >----
|> : >Digitec Online - South Africa
|> : >Telnet: bbs.digitec.co.za
|>
|> : Why dont you write a 'C' function and call it from your 4gl program ?
|>
|> : Habib
|>
|> You know, this seems to be one of the most common requests. I see it in
|> FAQ's, I've heard of other companies writing their own C for this, and
|> I've seen this in software packages selling this feature.
|>
|> This need seems almost universal. Isn't it time that Informix recognize
|> this and provide it as part of the language so that it can be a standard
|> as to how to read a flat-file?
|>
|> -Joel Schumacher
|> jschumac@uns-dv1.jcpenney.com OR jschumac@jcpenney.com
I agree but it's so easy to implement.
Look for my version of file I/O routines at
ftp://quasar.ucar.edu/pub/Informix_Archive/pub/flat_4gl/file_io.mr
Routines included:
* openfile(charstr filename, int file_flags) RETURNING int file_descriptor
* closefile(int file_descriptor) RETURNING int error_num
*
* readchar(int file_descriptor) RETURNING int error_num, char character_read
* readline(int file_descriptor) RETURNING int error_num, charstr line_read
*
* writechar(int file_descriptor, char char_to_write) RETURNING int error_num
* writeline(int file_descriptor, charstr line_to_write, int str_length, int add_newline)
* RETURNING int error_num
*
* tmpfilename(charstr temp_dir_name, charstr tempfile_name_prefix)
* RETURNING int error_num, charstr temporary_filename
*
* getprocid() RETURNING int pid
*
* getpprocid() RETURNING int ppid
*
* deletefile(charstr filename_to_delete) RETURNING int error_num
*
* statfile(charstr filename_to_stat)
* RETURNING int error_num,
* charstr owner_name,
* charstr group_name,
* charstr mode_string, Ex: 664
* long file_size,
* int file_type, Ex: FT_PLAINFILE, FT_DIRECTORY, etc.
* charstr last_access_time, Ex: "1994-12-31 23:59:59"
* charstr last_modification_time, Ex: "1994-12-31 23:59:59"
* charstr last_status_change_time Ex: "1994-12-31 23:59:59"
*
* createfile(charstr filename_to_create) RETURNING int error_num
*
* purgefile(charstr filename_to_purge) RETURNING int error_num
* (Has a problem....)
*
* fileseek(int file_descriptor, long offset, int origin) RETURNING int error_num
*
* renamefile(charstr orig_file_name, charstr new_file_name) RETURNING int error_num
*
* filetell(int file_descriptor) RETURNING long offset
--
----------------------------------------------------------------------------
Mike Reetz reetz@ncar.ucar.edu 3450 Mitchell Ln
UNIX(tm) Operations Manager (303)497-8881(V) 497-8501(F) Building 1
UCAR - University Corporation For Atmospheric Research Boulder, CO 80301