Read ASCII file from a 4GL program
Posted in 2005
Emma needed a 4GL program to look up a vendor name (in Japanese characters) by vendor_id from a comma-delimited ASCII file and print it in a report. Most replies suggested the standard trick: CREATE TEMP TABLE, LOAD FROM the file with DELIMITER ",", then read it with a cursor (ACE reports can also read ASCII files directly). Emma rejected this because the Japanese text came back distorted after loading/unloading, apparently a locale/non-Unicode database issue (DB_LOCALE/CLIENT_LOCALE were queried but never stated). Alternatives offered were the 'channel' library in newer 4GL versions (Dynamic, 4Js, Aubit4GL) or linking in C code. No confirmed resolution is recorded.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
From a 4GL program I have got to read an ASCII File (comma delimited) that contain 2 fields vendor_id and vendor_name. The 4GL needs to read the vendor_name (in Japanese character) for a particular vendor_id and stored the vendor name into a variable and output it to a report. Anyone knows how this can be achieved quickly ? Many Thanks Emma ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
If I understand, you almost have it: Create a temporary table in your 4gl, load the comma delimited file into the temp table and process it as normal (with a cursor sending data to a report). J. -----Original Message----- From: "Emma Charles " <charlesemma@yahoo.com> To: ids@iiug.org Date: Fri, 29 Jul 2005 08:37:11 -0400 (EDT) Subject: Read ASCII file from a 4GL program [5517] From a 4GL program I have got to read an ASCII File (comma delimited) that contain 2 fields vendor_id and vendor_name. The 4GL needs to read the vendor_name (in Japanese character) for a particular vendor_id and stored the vendor name into a variable and output it to a report. Anyone knows how this can be achieved quickly ? Many Thanks Emma ___________________________________________________________ To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com Jean Sagi jeansagi@myrealbox.com jeansagi@gmail.com
I
cannot use the create ... load solution below as
many of you are suggesting as the second field is in
Japanese character and as soon as I load it into an
informix table, the information is distored. I want
from my 4GL scan the ascii file for an ID and find the
name in Japanese and return it to the 4GL.
Any one there who can help ???
Create temp table <table_name> ( col1 char(XX), col2
CHAR(XX)) with no
log
load from "file_name" delimiter "," insert into<table_name>
declare my_cursor cursor for select * from
<table_name> etc
--- Emma Charles <charlesemma@yahoo.com> wrote:
> From a 4GL program I have got to read an ASCII File
> (comma delimited) that contain 2 fields vendor_id
> and
> vendor_name. The 4GL needs to read the vendor_name
> (in Japanese character) for a particular vendor_id
> and
> stored the vendor name into a variable and output it
> to a report.
>
> Anyone knows how this can be achieved quickly ?
>
> Many Thanks
> Emma
>
>
>
>
___________________________________________________________
>
> To help you stay safe and secure online, we've
> developed the all new Yahoo! Security Centre.
> http://uk.security.yahoo.com
>
>
___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre. http://uk.security.yahoo.com
All I
know from the Support people is that the
database does not support unicode. I tried to load
the 2 fields vendorid, vendorname (which is in
Japanese) into a table which I succeeded. But when I
an unload from the table and look at it in Windows,
the Japanese character is all distorted, i.e. not the
same. That is why I cannot load the data in a table
because as soon as I load it in, the information
(japanese character) is distorted.
I rather read the ASCII file from my 4GL using an ID
and passing back the description of that ID to my 4GL
program.
--- Gerald Cousins <gcousins@us.ibm.com> wrote:
> Hi Emma,
>
> You've stated that the data that you are using is
> Japanese, but not what
> locales you are using (either with the DB_LOCALE or
> CLIENT_LOCALE)
> Can you also state the nature of the distortion.
>
> Gerry.
>
>
>
>
> "Emma Charles " <charlesemma@yahoo.com>
> Sent by: forum.subscriber@iiug.org
> 07/29/2005 10:24 AM
>
> To
> ids@iiug.org
> cc
>
> Subject
> Re: Read ASCII file from a 4GL program [5520]
>
>
>
>
>
>
> I cannot use the create ... load solution below as
> many of you are suggesting as the second field is in
> Japanese character and as soon as I load it into an
> informix table, the information is distored. I want
> from my 4GL scan the ascii file for an ID and find
> the
> name in Japanese and return it to the 4GL.
>
> Any one there who can help ???
>
> Create temp table <table_name> ( col1 char(XX), col2
> CHAR(XX)) with no
> log
>
> load from "file_name" delimiter "," insert into> <table_name>
>
> declare my_cursor cursor for select * from
> <table_name> etc
>
> --- Emma Charles <charlesemma@yahoo.com> wrote:
>
> > From a 4GL program I have got to read an ASCII
> File
> > (comma delimited) that contain 2 fields vendor_id
> > and
> > vendor_name. The 4GL needs to read the
> vendor_name
> > (in Japanese character) for a particular vendor_id
> > and
> > stored the vendor name into a variable and output
> it
> > to a report.
> >
> > Anyone knows how this can be achieved quickly ?
> >
> > Many Thanks
> > Emma
> >
> >
> >
> >
>
___________________________________________________________
> >
> > To help you stay safe and secure online, we've
> > developed the all new Yahoo! Security Centre.
> > http://uk.security.yahoo.com
> >
> >
>
>
>
>
>
___________________________________________________________
>
> To help you stay safe and secure online, we've
> developed the all new
> Yahoo! Security Centre. http://uk.security.yahoo.com
>
>
>
>
___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail
http://uk.messenger.yahoo.com
Maybe
as simple as :
CREATE TEMP TABLE sometab (vendor char(20),name char(20));
LOAD FROM "somefile" DELIMITER "," INSERT INTO sometab;
DECLARE c_name CURSOR FOR
SELECT * FROM sometab
....
FWIW - ACE reports can read ascii files directly...
On Friday 29 July 2005 13:37, Emma Charles wrote:
> >From a 4GL program I have got to read an ASCII File
>
> (comma delimited) that contain 2 fields vendor_id and
> vendor_name. The 4GL needs to read the vendor_name
> (in Japanese character) for a particular vendor_id and
> stored the vendor name into a variable and output it
> to a report.
>
> Anyone knows how this can be achieved quickly ?
>
> Many Thanks
> Emma
>
>
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new Yahoo!
> Security Centre. http://uk.security.yahoo.com
--
Mike Aubury
Well -
new versions of 4GL (Dynamic, 4Js & Aubit4GL) have the 'channel'
library.
You could also write some C code to handle it (are you using C or PCode ?) and
link that in...
On Friday 29 July 2005 16:24, Emma Charles wrote:
> I cannot use the create ... load solution below as
> many of you are suggesting as the second field is in
> Japanese character and as soon as I load it into an
> informix table, the information is distored. I want
> from my 4GL scan the ascii file for an ID and find the
> name in Japanese and return it to the 4GL.
>
> Any one there who can help ???
>
> Create temp table <table_name> ( col1 char(XX), col2
> CHAR(XX)) with no
> log
>
> load from "file_name" delimiter "," insert into> <table_name>
>
> declare my_cursor cursor for select * from
> <table_name> etc
>
> --- Emma Charles <charlesemma@yahoo.com> wrote:
> > From a 4GL program I have got to read an ASCII File
> > (comma delimited) that contain 2 fields vendor_id
> > and
> > vendor_name. The 4GL needs to read the vendor_name
> > (in Japanese character) for a particular vendor_id
> > and
> > stored the vendor name into a variable and output it
> > to a report.
> >
> > Anyone knows how this can be achieved quickly ?
> >
> > Many Thanks
> > Emma
>
> ___________________________________________________________
>
> > To help you stay safe and secure online, we've
> > developed the all new Yahoo! Security Centre.
> > http://uk.security.yahoo.com
>
> ___________________________________________________________
> To help you stay safe and secure online, we've developed the all new Yahoo!
> Security Centre. http://uk.security.yahoo.com
--
Mike Aubury