Re: Can a 4GL program read an ASCII file?
Posted in 1994
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
james-holthaus@uiowa.edu (James Holthaus) writes: >In article <357f7q$i0l@search01.news.aol.com>, hoopscraz@aol.com >(HoopsCraz) wrote: >> I'm trying to create a process that will read in an ASCII file one record >> at a time and update appropriate tables based on a key. The ASCII file >> consists transaction headers that may have one or many detail lines >> following them. >> >> My question is this: Is it possible for a 4GL program to read directly >> from >> an ASCII file? I have looked briefly at using a C program, would this be >> the >> solution to choose, using PUSH and POP? >> >> Any suggestions would be appreciated. >Well, you could load the ASCII file into a temp table of some sort which >has only one column of type CHAR(255) and then manipulate the rows of the >table accordingly. You might need to do some preprocessing on this one to >insure you keep the data in the file in appropriate order. Prepending an >ascending integer and delimiter character to each line with perl, C, or >/bin/sh, and having two columns (one integer and one char) should be >enough. Using two columns (int and char) should be enough for ordering. Why prepend an int to the string stored, too?????? >You might find it easier to do if you use perl to read the ASCII file and >then call a 4ge with some command line parameters for execution. This >will work best if you have relatively few items to pass along the command >line. >-- Another alternative: create 4gl input/output routines in C (or esql/c) and create either a) a program library or b) a new code runner (fglgo) (RDS). This is the most efficient solution. And only takes more time in the first project; then you have it forever! See your manuals for details of this, or follow up to the group, or send me mail for more detail if you like... Regards, William G. Hudacek Internet: whudace@andy.bgsu.edu 372-2911 (department) No Phone ;-( (office) University Computer Services (Hayes Hall, Rm 332) Bowling Green State University Bowling Green, OH 43403 -- William G. Hudacek Internet: whudace@andy.bgsu.edu 372-2911 (department) No Phone ;-( (office) University Computer Services (Hayes Hall, Rm 332) Bowling Green State University Bowling Green, OH 43403