Re: Set record length of output file
Posted in 1998
Topics: SQL Development & Query Writing, Data Types & Schema Design
In article <364222A6.6D2@bloomberg.net>, "Art S. Kagel" <kagel@bloomberg.net> writes: >den2@Lehigh.EDU wrote: >> >> I am using the OUTPUT command to send the results of an SQL >> query to a file. Is there an option somewhere to set the >> record length of the file created to something other than >> 80 columns? > >No but someone submitted a set of scripts to the IIUG Software >Repository to reformat the folded output into tabular form. Look for >it. I looked for it and found it. Here is what happened: I have output from an SQL query that looks like this: dbfile_no 170 file_name acad_cal_rec track_code STU file_type T iqfile_no txt Academic Calendar Record descr1 Specifies the beginning and ending dates for the valid academic s essions. descr2 descr3 descr4 The descr* columns are varchar(78) which means that sometimes they wrap. What the awk script in the IIUG archive does is to read the lines sequentially until it finds an empty line which signals end of record. Therefore, instead of reading all of descr1 it puts "essions" as the value for descr2. Then descr2 becomes descr3 and descr4 is ignored, blank line, end of record, start over. Since the descr* lengths are 78, I thought that writing the output with no headings would solve the problem, but it still indents before writing out the column value. Why? If anyone knows an already canned solution I would be grateful, otherwise I will have to resort to doing some work which I would like to avoid. Wouldn't it just be easier to have an option like output to <filename> lrecl=120 Thanks, Dean