Page 1 of 1

Sequential file - Record delimiter

Posted: Fri Oct 21, 2005 2:28 am
by bakul
Hello,

I am writing records to a sequential file and then using a shell script to split the file. The record delimiter is 'UNIX Newline' and the final delimiter is 'end'.
There are 2 columns in the file and the second column is a VarChar(2000). The second column itself contains double quotes. When I use an awk command to retrieve the second column, only a partial string is retrieved.
If I open the file and manually, press enter at the end of every record and delete the line (effectively put a UNIX newline at the end), the awk statement gives the correct results.
What could be the reason for this? What change should I make to ensure that the file is read correctly.

Regards,
Bakul

Posted: Fri Oct 21, 2005 11:12 am
by roy
Hi,
The reason is ascii zero.
This will occur for example when you open in DS basicv code a seq file and seek to a position after EOF, in this case automaticaly every place skipped till the new written position will get ASCII CHAR 0 (see the basic.pdf documentation of the seek statement).
IHTH,

Posted: Sun Oct 23, 2005 10:47 pm
by bakul
Thanks for your reply! But I am not sure I understand it completely. :?:
Is it because the ascii 0 char is not present or is it because it is present?
In either case, what is the workaround? How can I ensure that the complete record will be returned by the awk statement? Is there some specific setting for the sequential file stage to achieve this?