Re: [U2] Help needed..

2013-05-07 Thread Wjhonson
I believe this problem might exist if you are reading a Windows file with a 
Unix-based version of U2.
However, I can read Windows files with a Windows-based version of Universe 
without the need to convert any line endings


 

 

 

-Original Message-
From: Israel, John R. 
To: U2 Users List 
Sent: Tue, May 7, 2013 4:55 am
Subject: Re: [U2] Help needed..


Note that if the file was built in Windows, it may have a CR:LF combination at 
the end of each line.

Reading it in, PICK will cleanly distinguish one as a line delimiter, but you 
will still have the extra (unwanted) character at the end of ROW.

I forget which one is which, but any time you read in a row from a TXT file, 
you 
will want to convert the unwanted character (I believe it is a CHAR(13)).

JRI


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Tom Whitmore
Sent: Tuesday, May 07, 2013 7:46 AM
To: U2 Users List
Subject: Re: [U2] Help needed..

Hi,
Personally, I would use OPENSEQ and READSEQ.  Each READSEQ would read the next 
field in the record.   The file needs to be a type 1 or type 19 for OPENSEQ.
An example of this is:
   OPENSEQ FILE.NAME2, KEY.TXT TO SOURCE.FN ELSE STOP 'Unable to open ':KEY.TXT
   LOOP
  READSEQ ROW FROM SOURCE.FN ELSE EXIT
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT

If the file isn't a type 1 or 19 then use the REMOVE function on the internal 
array.  It is very fast.
An example is:
   READ TXT.REC FROM F., KEY.TXT
   TXT.REC=TXT.REC
   LOOP
  REMOVE ROW FROM TXT.REC SETTING POS
   UNTIL ROW='' AND POS=0
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT
If you need to reprocess the array then add "TXT.REC=TXT.REC" and start the 
process again.  The reason is that assigning the array to itself will reset the 
internal pointer REMOVE uses to keep track of where it is.

One caveat, REMOVE goes to the next delimiter (field, value, subvalue or text 
mark) so you need to know the data you are working with.

Tom
RATEX Business Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Sathya
Sent: Tuesday, May 07, 2013 12:36 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Help needed..


Wjhonson  aol.com> writes:

> 
> That's interesting John, but the del *does* in fact *shift* the entire 
array forward each time.
> It really does :)
> 
> You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents
> *once* into a type of Get List (it works try it!)
> 
> You can then use a READNEXT to extract each row, without the need to 
rescan from the beginning, since
> READNEXT has always maintainted a pointer to where it left off.  It 
doesn't start at the front each time.


Hi 

I just used OSOPEN to open the file and the file is not getting 
recognized. 

Here is the piece of script I have used. 

OSOPEN FILE.NAME2 TO F.KEYFILE ELSE STOP "CAN Not find file"

Where FILE.NAME2 is the path and the file name. 

Also as suggested below, how could I use get list for a file which is 
opened from server. 

Thanks in Advance,
Sathya V. 


> 
> -Original Message-
> From: Israel, John R.  daytonsuperior.com>
> To: 'U2 Users List'  listserver.u2ug.org>
> Sent: Tue, Apr 30, 2013 9:27 am
> Subject: Re: [U2] Help needed..
> 
> Here is some fast and loose code that I often use.
> 
> READ TXT.REC FROM F., KEY.TXT
> LOOP
>   ROW = TXT<1>
> WHILE ROW # ""
>   DEL TXT<1>  ;* Make the TXT file smaller and smaller 
and not traversing deeper 
> and deeper
>   CONVERT CHAR(9) TO   FM IN ROW
>   KEY = ROW<1>;* extract the key out of the row
>   DEL ROW<1>  ;* Remove the key from the row - all that 
is left is the record
>   WRITE ROW ON F.XXX, KEY
> REPEAT
> 
> JRI
> 
> -Original Message-
> From: u2-users-bounces  listserver.u2ug.org [mailto:u2-users-bounces 
 listserver.u2ug.org] 
> On Behalf Of Sathya
> Sent: Tuesday, April 30, 2013 11:21 AM
> To: u2-users  listserver.u2ug.org
> Subject: [U2] Help needed..
> 
> Hi all,..
> 
> I have a requirement here. Need guidance in doing that. Any help will be 
useful. 
> 
> TIA.
> 
> I have a flat file with tab delimited records and the file looks like 
below:
> 
> abcd 1234
> cdef 3478
> ghae 6284
> ...
> 
> I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
some 
> corresponding attributes from a file which has 'abcd' and 'cdef' as the 
key 
> values. Please let me know if this could be done. If yes any kinda basic 
> suggesti

Re: [U2] Help needed..

2013-05-07 Thread Aaron Titus
I don't think you should be using OSOPEN.  This is for block IO.  Aren't
you reading a sequential file one line a t a time?


*Aaron Titus*
Senior Software Engineer
F.W. Davison & Company, Inc.
508-747-7261 x245
ati...@fwdco.com



On Tue, May 7, 2013 at 7:54 AM, Israel, John R. <
johnisr...@daytonsuperior.com> wrote:

> Note that if the file was built in Windows, it may have a CR:LF
> combination at the end of each line.
>
> Reading it in, PICK will cleanly distinguish one as a line delimiter, but
> you will still have the extra (unwanted) character at the end of ROW.
>
> I forget which one is which, but any time you read in a row from a TXT
> file, you will want to convert the unwanted character (I believe it is a
> CHAR(13)).
>
> JRI
>
>
> -Original Message-
> From: u2-users-boun...@listserver.u2ug.org [mailto:
> u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
> Sent: Tuesday, May 07, 2013 7:46 AM
> To: U2 Users List
> Subject: Re: [U2] Help needed..
>
> Hi,
> Personally, I would use OPENSEQ and READSEQ.  Each READSEQ would read the
> next field in the record.   The file needs to be a type 1 or type 19 for
> OPENSEQ.
> An example of this is:
>OPENSEQ FILE.NAME2, KEY.TXT TO SOURCE.FN ELSE STOP 'Unable to open
> ':KEY.TXT
>LOOP
>   READSEQ ROW FROM SOURCE.FN ELSE EXIT
>   ROW=CONVERT(CHAR(9),FM,ROW)
>   WRITE ROW TO F.XXX,KEY
>REPEAT
>
> If the file isn't a type 1 or 19 then use the REMOVE function on the
> internal array.  It is very fast.
> An example is:
>READ TXT.REC FROM F., KEY.TXT
>TXT.REC=TXT.REC
>LOOP
>   REMOVE ROW FROM TXT.REC SETTING POS
>UNTIL ROW='' AND POS=0
>   ROW=CONVERT(CHAR(9),FM,ROW)
>   WRITE ROW TO F.XXX,KEY
>REPEAT
> If you need to reprocess the array then add "TXT.REC=TXT.REC" and start
> the process again.  The reason is that assigning the array to itself will
> reset the internal pointer REMOVE uses to keep track of where it is.
>
> One caveat, REMOVE goes to the next delimiter (field, value, subvalue or
> text mark) so you need to know the data you are working with.
>
> Tom
> RATEX Business Solutions
>
>
> -----Original Message-----
> From: u2-users-boun...@listserver.u2ug.org [mailto:
> u2-users-boun...@listserver.u2ug.org] On Behalf Of Sathya
> Sent: Tuesday, May 07, 2013 12:36 AM
> To: u2-users@listserver.u2ug.org
> Subject: Re: [U2] Help needed..
>
>
> Wjhonson  aol.com> writes:
>
> >
> > That's interesting John, but the del *does* in fact *shift* the entire
> array forward each time.
> > It really does :)
> >
> > You can traverse without re-scanning by using the SELECT or SELECTV to
> transform the entire contents
> > *once* into a type of Get List (it works try it!)
> >
> > You can then use a READNEXT to extract each row, without the need to
> rescan from the beginning, since
> > READNEXT has always maintainted a pointer to where it left off.  It
> doesn't start at the front each time.
>
>
> Hi
>
> I just used OSOPEN to open the file and the file is not getting
> recognized.
>
> Here is the piece of script I have used.
>
> OSOPEN FILE.NAME2 TO F.KEYFILE ELSE STOP "CAN Not find file"
>
> Where FILE.NAME2 is the path and the file name.
>
> Also as suggested below, how could I use get list for a file which is
> opened from server.
>
> Thanks in Advance,
> Sathya V.
>
>
> >
> > -Original Message-
> > From: Israel, John R.  daytonsuperior.com>
> > To: 'U2 Users List'  listserver.u2ug.org>
> > Sent: Tue, Apr 30, 2013 9:27 am
> > Subject: Re: [U2] Help needed..
> >
> > Here is some fast and loose code that I often use.
> >
> > READ TXT.REC FROM F., KEY.TXT
> > LOOP
> >   ROW = TXT<1>
> > WHILE ROW # ""
> >   DEL TXT<1>  ;* Make the TXT file smaller and smaller
> and not traversing deeper
> > and deeper
> >   CONVERT CHAR(9) TO   FM IN ROW
> >   KEY = ROW<1>;* extract the key out of the row
> >   DEL ROW<1>  ;* Remove the key from the row - all that
> is left is the record
> >   WRITE ROW ON F.XXX, KEY
> > REPEAT
> >
> > JRI
> >
> > -Original Message-
> > From: u2-users-bounces  listserver.u2ug.org [mailto:u2-users-bounces
>  listserver.u2ug.org]
> > On Behalf Of Sathya
> > Sent: Tuesday, April 30, 2013 11:21 AM
> > To: u2-users  listserver.u2ug.org
> > Subject: [U2] Help needed..
> >
> > Hi 

Re: [U2] Help needed..

2013-05-07 Thread Israel, John R.
Note that if the file was built in Windows, it may have a CR:LF combination at 
the end of each line.

Reading it in, PICK will cleanly distinguish one as a line delimiter, but you 
will still have the extra (unwanted) character at the end of ROW.

I forget which one is which, but any time you read in a row from a TXT file, 
you will want to convert the unwanted character (I believe it is a CHAR(13)).

JRI


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tom Whitmore
Sent: Tuesday, May 07, 2013 7:46 AM
To: U2 Users List
Subject: Re: [U2] Help needed..

Hi,
Personally, I would use OPENSEQ and READSEQ.  Each READSEQ would read the next 
field in the record.   The file needs to be a type 1 or type 19 for OPENSEQ.
An example of this is:
   OPENSEQ FILE.NAME2, KEY.TXT TO SOURCE.FN ELSE STOP 'Unable to open ':KEY.TXT
   LOOP
  READSEQ ROW FROM SOURCE.FN ELSE EXIT
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT

If the file isn't a type 1 or 19 then use the REMOVE function on the internal 
array.  It is very fast.
An example is:
   READ TXT.REC FROM F., KEY.TXT
   TXT.REC=TXT.REC
   LOOP
  REMOVE ROW FROM TXT.REC SETTING POS
   UNTIL ROW='' AND POS=0
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT
If you need to reprocess the array then add "TXT.REC=TXT.REC" and start the 
process again.  The reason is that assigning the array to itself will reset the 
internal pointer REMOVE uses to keep track of where it is.

One caveat, REMOVE goes to the next delimiter (field, value, subvalue or text 
mark) so you need to know the data you are working with.

Tom
RATEX Business Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Sathya
Sent: Tuesday, May 07, 2013 12:36 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Help needed..


Wjhonson  aol.com> writes:

> 
> That's interesting John, but the del *does* in fact *shift* the entire 
array forward each time.
> It really does :)
> 
> You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents
> *once* into a type of Get List (it works try it!)
> 
> You can then use a READNEXT to extract each row, without the need to 
rescan from the beginning, since
> READNEXT has always maintainted a pointer to where it left off.  It 
doesn't start at the front each time.


Hi 

I just used OSOPEN to open the file and the file is not getting 
recognized. 

Here is the piece of script I have used. 

OSOPEN FILE.NAME2 TO F.KEYFILE ELSE STOP "CAN Not find file"

Where FILE.NAME2 is the path and the file name. 

Also as suggested below, how could I use get list for a file which is 
opened from server. 

Thanks in Advance,
Sathya V. 


> 
> -Original Message-
> From: Israel, John R.  daytonsuperior.com>
> To: 'U2 Users List'  listserver.u2ug.org>
> Sent: Tue, Apr 30, 2013 9:27 am
> Subject: Re: [U2] Help needed..
> 
> Here is some fast and loose code that I often use.
> 
> READ TXT.REC FROM F., KEY.TXT
> LOOP
>   ROW = TXT<1>
> WHILE ROW # ""
>   DEL TXT<1>  ;* Make the TXT file smaller and smaller 
and not traversing deeper 
> and deeper
>   CONVERT CHAR(9) TO   FM IN ROW
>   KEY = ROW<1>;* extract the key out of the row
>   DEL ROW<1>  ;* Remove the key from the row - all that 
is left is the record
>   WRITE ROW ON F.XXX, KEY
> REPEAT
> 
> JRI
> 
> -Original Message-
> From: u2-users-bounces  listserver.u2ug.org [mailto:u2-users-bounces 
 listserver.u2ug.org] 
> On Behalf Of Sathya
> Sent: Tuesday, April 30, 2013 11:21 AM
> To: u2-users  listserver.u2ug.org
> Subject: [U2] Help needed..
> 
> Hi all,..
> 
> I have a requirement here. Need guidance in doing that. Any help will be 
useful. 
> 
> TIA.
> 
> I have a flat file with tab delimited records and the file looks like 
below:
> 
> abcd 1234
> cdef 3478
> ghae 6284
> ...
> 
> I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
some 
> corresponding attributes from a file which has 'abcd' and 'cdef' as the 
key 
> values. Please let me know if this could be done. If yes any kinda basic 
> suggestions in doing that will be helpful. 
> 
> Thanks again,
> Sathya V. 
> 
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> ___
> U2-Users mailing list
> U2-Users  listser

Re: [U2] Help needed..

2013-05-07 Thread Tom Whitmore
Hi,
Personally, I would use OPENSEQ and READSEQ.  Each READSEQ would read the next 
field in the record.   The file needs to be a type 1 or type 19 for OPENSEQ.
An example of this is:
   OPENSEQ FILE.NAME2, KEY.TXT TO SOURCE.FN ELSE STOP 'Unable to open ':KEY.TXT
   LOOP
  READSEQ ROW FROM SOURCE.FN ELSE EXIT
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT

If the file isn't a type 1 or 19 then use the REMOVE function on the internal 
array.  It is very fast.
An example is:
   READ TXT.REC FROM F., KEY.TXT
   TXT.REC=TXT.REC
   LOOP
  REMOVE ROW FROM TXT.REC SETTING POS
   UNTIL ROW='' AND POS=0
  ROW=CONVERT(CHAR(9),FM,ROW)
  WRITE ROW TO F.XXX,KEY
   REPEAT
If you need to reprocess the array then add "TXT.REC=TXT.REC" and start the 
process again.  The reason is that assigning the array to itself will reset the 
internal pointer REMOVE uses to keep track of where it is.

One caveat, REMOVE goes to the next delimiter (field, value, subvalue or text 
mark) so you need to know the data you are working with.

Tom
RATEX Business Solutions


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Sathya
Sent: Tuesday, May 07, 2013 12:36 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Help needed..


Wjhonson  aol.com> writes:

> 
> That's interesting John, but the del *does* in fact *shift* the entire 
array forward each time.
> It really does :)
> 
> You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents
> *once* into a type of Get List (it works try it!)
> 
> You can then use a READNEXT to extract each row, without the need to 
rescan from the beginning, since
> READNEXT has always maintainted a pointer to where it left off.  It 
doesn't start at the front each time.


Hi 

I just used OSOPEN to open the file and the file is not getting 
recognized. 

Here is the piece of script I have used. 

OSOPEN FILE.NAME2 TO F.KEYFILE ELSE STOP "CAN Not find file"

Where FILE.NAME2 is the path and the file name. 

Also as suggested below, how could I use get list for a file which is 
opened from server. 

Thanks in Advance,
Sathya V. 


> 
> -Original Message-
> From: Israel, John R.  daytonsuperior.com>
> To: 'U2 Users List'  listserver.u2ug.org>
> Sent: Tue, Apr 30, 2013 9:27 am
> Subject: Re: [U2] Help needed..
> 
> Here is some fast and loose code that I often use.
> 
> READ TXT.REC FROM F., KEY.TXT
> LOOP
>   ROW = TXT<1>
> WHILE ROW # ""
>   DEL TXT<1>  ;* Make the TXT file smaller and smaller 
and not traversing deeper 
> and deeper
>   CONVERT CHAR(9) TO   FM IN ROW
>   KEY = ROW<1>;* extract the key out of the row
>   DEL ROW<1>  ;* Remove the key from the row - all that 
is left is the record
>   WRITE ROW ON F.XXX, KEY
> REPEAT
> 
> JRI
> 
> -Original Message-
> From: u2-users-bounces  listserver.u2ug.org [mailto:u2-users-bounces 
 listserver.u2ug.org] 
> On Behalf Of Sathya
> Sent: Tuesday, April 30, 2013 11:21 AM
> To: u2-users  listserver.u2ug.org
> Subject: [U2] Help needed..
> 
> Hi all,..
> 
> I have a requirement here. Need guidance in doing that. Any help will be 
useful. 
> 
> TIA.
> 
> I have a flat file with tab delimited records and the file looks like 
below:
> 
> abcd 1234
> cdef 3478
> ghae 6284
> ...
> 
> I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
some 
> corresponding attributes from a file which has 'abcd' and 'cdef' as the 
key 
> values. Please let me know if this could be done. If yes any kinda basic 
> suggestions in doing that will be helpful. 
> 
> Thanks again,
> Sathya V. 
> 
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
>  
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> 




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-05-06 Thread Sathya

Wjhonson  aol.com> writes:

> 
> That's interesting John, but the del *does* in fact *shift* the entire 
array forward each time.
> It really does :)
> 
> You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents
> *once* into a type of Get List (it works try it!)
> 
> You can then use a READNEXT to extract each row, without the need to 
rescan from the beginning, since
> READNEXT has always maintainted a pointer to where it left off.  It 
doesn't start at the front each time.


Hi 

I just used OSOPEN to open the file and the file is not getting 
recognized. 

Here is the piece of script I have used. 

OSOPEN FILE.NAME2 TO F.KEYFILE ELSE STOP "CAN Not find file"

Where FILE.NAME2 is the path and the file name. 

Also as suggested below, how could I use get list for a file which is 
opened from server. 

Thanks in Advance,
Sathya V. 


> 
> -Original Message-
> From: Israel, John R.  daytonsuperior.com>
> To: 'U2 Users List'  listserver.u2ug.org>
> Sent: Tue, Apr 30, 2013 9:27 am
> Subject: Re: [U2] Help needed..
> 
> Here is some fast and loose code that I often use.
> 
> READ TXT.REC FROM F., KEY.TXT
> LOOP
>   ROW = TXT<1>
> WHILE ROW # ""
>   DEL TXT<1>  ;* Make the TXT file smaller and smaller 
and not traversing deeper 
> and deeper
>   CONVERT CHAR(9) TO   FM IN ROW
>   KEY = ROW<1>;* extract the key out of the row
>   DEL ROW<1>  ;* Remove the key from the row - all that 
is left is the record
>   WRITE ROW ON F.XXX, KEY
> REPEAT
> 
> JRI
> 
> -Original Message-
> From: u2-users-bounces  listserver.u2ug.org [mailto:u2-users-bounces 
 listserver.u2ug.org] 
> On Behalf Of Sathya
> Sent: Tuesday, April 30, 2013 11:21 AM
> To: u2-users  listserver.u2ug.org
> Subject: [U2] Help needed..
> 
> Hi all,..
> 
> I have a requirement here. Need guidance in doing that. Any help will be 
useful. 
> 
> TIA.
> 
> I have a flat file with tab delimited records and the file looks like 
below:
> 
> abcd 1234
> cdef 3478
> ghae 6284
> ...
> 
> I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
some 
> corresponding attributes from a file which has 'abcd' and 'cdef' as the 
key 
> values. Please let me know if this could be done. If yes any kinda basic 
> suggestions in doing that will be helpful. 
> 
> Thanks again,
> Sathya V. 
> 
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
>  
> ___
> U2-Users mailing list
> U2-Users  listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
> 
> 




___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Wjhonson
But the shifting is more expensive than the traversing :)


 

 

 

-Original Message-
From: Israel, John R. 
To: 'U2 Users List' 
Sent: Tue, Apr 30, 2013 10:02 am
Subject: Re: [U2] Help needed..


Yes, I understand it shifts everything, but you are not traversing deeper with 
each loop.  You are only going 1 deep every time.  Old school.  :-)

John


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Wjhonson
Sent: Tuesday, April 30, 2013 12:48 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Help needed..

That's interesting John, but the del *does* in fact *shift* the entire array 
forward each time.
It really does :)

You can traverse without re-scanning by using the SELECT or SELECTV to 
transform 
the entire contents *once* into a type of Get List (it works try it!)

You can then use a READNEXT to extract each row, without the need to rescan 
from 
the beginning, since READNEXT has always maintainted a pointer to where it left 
off.  It doesn't start at the front each time.


 

 

 

-Original Message-
From: Israel, John R. 
To: 'U2 Users List' 
Sent: Tue, Apr 30, 2013 9:27 am
Subject: Re: [U2] Help needed..


Here is some fast and loose code that I often use.

READ TXT.REC FROM F., KEY.TXT
LOOP
ROW = TXT<1>
WHILE ROW # ""
DEL TXT<1>  ;* Make the TXT file smaller and smaller and 
not traversing deeper 
and deeper
CONVERT CHAR(9) TO @FM IN ROW
KEY = ROW<1>;* extract the key out of the row
DEL ROW<1>  ;* Remove the key from the row - all that is 
left is the record
WRITE ROW ON F.XXX, KEY
REPEAT


JRI

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org]
On Behalf Of Sathya
Sent: Tuesday, April 30, 2013 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Help needed..

Hi all,..

I have a requirement here. Need guidance in doing that. Any help will be 
useful. 



TIA.

I have a flat file with tab delimited records and the file looks like below:

abcd 1234
cdef 3478
ghae 6284
...

I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch some 
corresponding attributes from a file which has 'abcd' and 'cdef' as the key 
values. Please let me know if this could be done. If yes any kinda basic 
suggestions in doing that will be helpful. 

Thanks again,
Sathya V. 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Israel, John R.
Yes, I understand it shifts everything, but you are not traversing deeper with 
each loop.  You are only going 1 deep every time.  Old school.  :-)

John


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Tuesday, April 30, 2013 12:48 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Help needed..

That's interesting John, but the del *does* in fact *shift* the entire array 
forward each time.
It really does :)

You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents *once* into a type of Get List (it works try it!)

You can then use a READNEXT to extract each row, without the need to rescan 
from the beginning, since READNEXT has always maintainted a pointer to where it 
left off.  It doesn't start at the front each time.


 

 

 

-Original Message-
From: Israel, John R. 
To: 'U2 Users List' 
Sent: Tue, Apr 30, 2013 9:27 am
Subject: Re: [U2] Help needed..


Here is some fast and loose code that I often use.

READ TXT.REC FROM F., KEY.TXT
LOOP
ROW = TXT<1>
WHILE ROW # ""
DEL TXT<1>  ;* Make the TXT file smaller and smaller and 
not traversing deeper 
and deeper
CONVERT CHAR(9) TO @FM IN ROW
KEY = ROW<1>;* extract the key out of the row
DEL ROW<1>  ;* Remove the key from the row - all that is 
left is the record
WRITE ROW ON F.XXX, KEY
REPEAT


JRI

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org]
On Behalf Of Sathya
Sent: Tuesday, April 30, 2013 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Help needed..

Hi all,..

I have a requirement here. Need guidance in doing that. Any help will be 
useful. 


TIA.

I have a flat file with tab delimited records and the file looks like below:

abcd 1234
cdef 3478
ghae 6284
...

I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch some 
corresponding attributes from a file which has 'abcd' and 'cdef' as the key 
values. Please let me know if this could be done. If yes any kinda basic 
suggestions in doing that will be helpful. 

Thanks again,
Sathya V. 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Wjhonson
That's interesting John, but the del *does* in fact *shift* the entire array 
forward each time.
It really does :)

You can traverse without re-scanning by using the SELECT or SELECTV to 
transform the entire contents *once* into a type of Get List (it works try it!)

You can then use a READNEXT to extract each row, without the need to rescan 
from the beginning, since READNEXT has always maintainted a pointer to where it 
left off.  It doesn't start at the front each time.


 

 

 

-Original Message-
From: Israel, John R. 
To: 'U2 Users List' 
Sent: Tue, Apr 30, 2013 9:27 am
Subject: Re: [U2] Help needed..


Here is some fast and loose code that I often use.

READ TXT.REC FROM F., KEY.TXT
LOOP
ROW = TXT<1>
WHILE ROW # ""
DEL TXT<1>  ;* Make the TXT file smaller and smaller and 
not traversing deeper 
and deeper
CONVERT CHAR(9) TO @FM IN ROW
KEY = ROW<1>;* extract the key out of the row
DEL ROW<1>  ;* Remove the key from the row - all that is 
left is the record
WRITE ROW ON F.XXX, KEY
REPEAT


JRI

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
On Behalf Of Sathya
Sent: Tuesday, April 30, 2013 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Help needed..

Hi all,..

I have a requirement here. Need guidance in doing that. Any help will be 
useful. 


TIA.

I have a flat file with tab delimited records and the file looks like below:

abcd 1234
cdef 3478
ghae 6284
...

I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch some 
corresponding attributes from a file which has 'abcd' and 'cdef' as the key 
values. Please let me know if this could be done. If yes any kinda basic 
suggestions in doing that will be helpful. 

Thanks again,
Sathya V. 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Manu Fernandes
Hi,

For fun :

EXECUTE "QSELECT &UFD& tabdelimitedname"
LOOP WHILE READNEXT LINE DO 
K = FIELD(LINE," ",1)
...
REPEAT

manu
> -Message d'origine-
> De : u2-users-boun...@listserver.u2ug.org [mailto:u2-users-
> boun...@listserver.u2ug.org] De la part de Allen Egerton
> Envoyé : mardi 30 avril 2013 17:57
> À : U2 Users List
> Objet : Re: [U2] Help needed..
> 
> On 4/30/2013 11:21 AM, Sathya wrote:
> > Hi all,..
> >
> > I have a requirement here. Need guidance in doing that. Any help will
> > be useful.
> >
> > TIA.
> >
> > I have a flat file with tab delimited records and the file looks like below:
> >
> > abcd 1234
> > cdef 3478
> > ghae 6284
> > ...
> >
> > I have to fetch the data 'abcd' and 'cdef' from this flat file and
> > fetch some corresponding attributes from a file which has 'abcd' and
> > 'cdef' as the key values. Please let me know if this could be done. If
> > yes any kinda basic suggestions in doing that will be helpful.
> >
> Lots of ways to solve this problem, here's a very quick and dirty untested 
> piece
> of code written off the top of my head...
> 
> PROMPT ""
> EQUATE TABCHAR TO CHAR(7)
> *
> 
> OPEN "", "&UFD&" TO F.UFD ELSE STOP "CAN'T OPEN UFD"
> READ D.UFD FROM F.UFD, "xxx.tabdelimitedname" ELSE CRT "Can't read tab-
> delimited file from current directory"
> STOP
> END
> OPEN "", "OTHERFILE" TO F.OTHER ELSE
> CRT "Can't open OTHERFILE file to retrieve data from"
> STOP
> END
> 
> REM1 = 999
> LOOP WHILE REM1 NE 0
> REMOVE LINE FROM D.UFD SETTING REM1
> K.OTHER = FIELD(LINE, TABCHAR, 1)
> READ D.OTHER FROM F.OTHER, K.OTHER THEN
> ONE = D.OTHER<1>
> TWO = D.OTHER<2>
> do something with the fields...
> END ELSE
> CRT "Cant' read record ": K.OTHER: " from OTHERFILE."
> END
> REPEAT
> *
> CRT "DONE"
> STOP
> 
> 
> --
> Allen Egerton; aeger...@pobox.com
> 
> 
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Israel, John R.
Here is some fast and loose code that I often use.

READ TXT.REC FROM F., KEY.TXT
LOOP
ROW = TXT<1>
WHILE ROW # ""
DEL TXT<1>  ;* Make the TXT file smaller and smaller and 
not traversing deeper and deeper
CONVERT CHAR(9) TO @FM IN ROW
KEY = ROW<1>;* extract the key out of the row
DEL ROW<1>  ;* Remove the key from the row - all that is 
left is the record
WRITE ROW ON F.XXX, KEY
REPEAT


JRI

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Sathya
Sent: Tuesday, April 30, 2013 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Help needed..

Hi all,..

I have a requirement here. Need guidance in doing that. Any help will be 
useful. 

TIA.

I have a flat file with tab delimited records and the file looks like below:

abcd 1234
cdef 3478
ghae 6284
...

I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch some 
corresponding attributes from a file which has 'abcd' and 'cdef' as the key 
values. Please let me know if this could be done. If yes any kinda basic 
suggestions in doing that will be helpful. 

Thanks again,
Sathya V. 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread George Gallen
I never used &UFD& before - I like that one. 


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Allen Egerton
Sent: Tuesday, April 30, 2013 11:57 AM
To: U2 Users List
Subject: Re: [U2] Help needed..

OPEN "", "&UFD&" TO F.UFD ELSE STOP "CAN'T OPEN UFD"
READ D.UFD FROM F.UFD, "xxx.tabdelimitedname" ELSE
CRT "Can't read tab-delimited file from current directory"
STOP
END
OPEN "", "OTHERFILE" TO F.OTHER ELSE
CRT "Can't open OTHERFILE file to retrieve data from"
STOP
END

REM1 = 999
LOOP WHILE REM1 NE 0
REMOVE LINE FROM D.UFD SETTING REM1
K.OTHER = FIELD(LINE, TABCHAR, 1)
READ D.OTHER FROM F.OTHER, K.OTHER THEN
ONE = D.OTHER<1>
TWO = D.OTHER<2>
do something with the fields...
END ELSE
CRT "Cant' read record ": K.OTHER: " from OTHERFILE."
END
REPEAT
*
CRT "DONE"
STOP


-- 
Allen Egerton; aeger...@pobox.com

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread George Gallen
OPENPATH "directory-of-tab-delimited-file" TO F.PATH ELSE STOP "Can not find 
directory"
OPEN "","Name-of-file-with-keys" TO F.KEYFILE ELSE STOP "CAN Not find file"
*
READ XDATA FROM F.PATH,"flat-file-name" ELSE STOP "Can not find flat filename"
MAXLINES=DCOUNT(XDATA,CHAR(254))
FOR T=1 TO MAXLINES
   LIN=XDATA
   KEYVALUE=FIELD(LIN,CHAR(9),1)
   VALUE=FIELD(LIN,CHAR(9),2)
   READ VDATA FROM F.KEYFILE,KEYVALUE ELSE PRINT KEYVALUE:" Not in Key File" ; 
CONTINUE
*
* could also read:
*
   READ VDATA FROM F.KEYFILE,KEYVALUE ELSE
  Insert code here as to what to do if the KEYVALUE does not exist in the 
FILE on the system
   END
*
*
...
...
   Insert code here as to what to do with the VALUES in the FILE on the system, 
and what
   To do with the VALUE in the flatfile
...
...
NEXT T
*
...
...


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Sathya
Sent: Tuesday, April 30, 2013 11:21 AM
To: u2-users@listserver.u2ug.org
Subject: [U2] Help needed..

Hi all,..

I have a requirement here. Need guidance in doing that. Any help will be 
useful. 

TIA.

I have a flat file with tab delimited records and the file looks like below:

abcd 1234
cdef 3478
ghae 6284
...

I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
some corresponding attributes from a file which has 'abcd' and 'cdef' as 
the key values. Please let me know if this could be done. If yes any kinda 
basic suggestions in doing that will be helpful. 

Thanks again, 
Sathya V. 

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Help needed..

2013-04-30 Thread Allen Egerton
On 4/30/2013 11:21 AM, Sathya wrote:
> Hi all,..
> 
> I have a requirement here. Need guidance in doing that. Any help will be 
> useful. 
> 
> TIA.
> 
> I have a flat file with tab delimited records and the file looks like below:
> 
> abcd 1234
> cdef 3478
> ghae 6284
> ...
> 
> I have to fetch the data 'abcd' and 'cdef' from this flat file and fetch 
> some corresponding attributes from a file which has 'abcd' and 'cdef' as 
> the key values. Please let me know if this could be done. If yes any kinda 
> basic suggestions in doing that will be helpful. 
> 
Lots of ways to solve this problem, here's a very quick and dirty
untested piece of code written off the top of my head...

PROMPT ""
EQUATE TABCHAR TO CHAR(7)
*

OPEN "", "&UFD&" TO F.UFD ELSE STOP "CAN'T OPEN UFD"
READ D.UFD FROM F.UFD, "xxx.tabdelimitedname" ELSE
CRT "Can't read tab-delimited file from current directory"
STOP
END
OPEN "", "OTHERFILE" TO F.OTHER ELSE
CRT "Can't open OTHERFILE file to retrieve data from"
STOP
END

REM1 = 999
LOOP WHILE REM1 NE 0
REMOVE LINE FROM D.UFD SETTING REM1
K.OTHER = FIELD(LINE, TABCHAR, 1)
READ D.OTHER FROM F.OTHER, K.OTHER THEN
ONE = D.OTHER<1>
TWO = D.OTHER<2>
do something with the fields...
END ELSE
CRT "Cant' read record ": K.OTHER: " from OTHERFILE."
END
REPEAT
*
CRT "DONE"
STOP


-- 
Allen Egerton; aeger...@pobox.com


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


RE: [U2] Help needed about the process being slow

2004-07-13 Thread Kevin King
1) Throttle the polling program so that it does not go out searching
for information repeatedly, but rather waits 1-2 seconds between
polls.

2) Put protections in place that will prevent the receiving program
from attempting to open a file in progress from the sender.  This may
be as simple as attaching an extension to the file when it is being
constructed, then after the file has been closed, rename it.

This symptom just sounds like the two are fighting for the resources,
and if that's true, these two ideas should help immensely.

-Kevin
[EMAIL PROTECTED]
http://www.PrecisOnline.com


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ashish ratna
Sent: Tuesday, July 13, 2004 8:10 AM
To: [EMAIL PROTECTED]
Subject: [U2] Help needed about the process being slow

Hi All,

We have a process (Universe program) which writes the records in a
particular file (type 19). One of my C process is picking these
records and processing them and the deleting them.

If I run first process independently (C process stopped) it is very
fast.
Also if I have few records in the file and C process is running
(Universe program stopped) this case C process works very fast.

But the problem is that when I try to run both the programs
simultaneously, the overall process becomes very slow.

In terms of data-
For writing 1800 records on a file by Universe it takes 3 min. (when C
is not
running)
For processing 1800 records C process takes very less time (when
universe is not running)

But if both processes are running then it takes about 25 mins to
complete the process.

Can  somebody tell me what could be the reason for this slowing down
of process.

Regards,
Ashish.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


RE: [U2] Help needed about the process being slow

2004-07-13 Thread Brian Leach
Hi,

I've just tried something similar on UV/NT with no problems - until I pushed
my external routine (scanning the directory and deleting the files as fast
as UV writes them) into a tight loop that swallowed the processor. Then it
all crawled, of course.

Could there be anything in your C routine that would cause that kind of
looping?

Just a thought - if the C routine fails to open one of these files (e.g. if
UV is still in process of writing it/holding it) how does your error
trapping work? Do you loop until you can open it? If so, that might cause
just that sort of loop, so that uv never gets a look in... 

Brian

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of ashish ratna
Sent: 13 July 2004 15:10
To: [EMAIL PROTECTED]
Subject: [U2] Help needed about the process being slow

Hi All,

We have a process (Universe program) which writes the records in a
particular file (type 19). One of my C process is picking these records and
processing them and the deleting them.

If I run first process independently (C process stopped) it is very fast.
Also if I have few records in the file and C process is running (Universe
program stopped) this case C process works very fast.

But the problem is that when I try to run both the programs simultaneously,
the overall process becomes very slow.

In terms of data-
For writing 1800 records on a file by Universe it takes 3 min. (when C is
not
running)
For processing 1800 records C process takes very less time (when universe is
not running)

But if both processes are running then it takes about 25 mins to complete
the process.

Can  somebody tell me what could be the reason for this slowing down of
process.

Regards,
Ashish.
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


This email was checked by MessageLabs SkyScan before entering Microgen.



This email was checked on leaving Microgen for viruses, similar
malicious code and inappropriate content by MessageLabs SkyScan.

DISCLAIMER

This email and any attachments are confidential and may also be
privileged.

If you are not the named recipient, please notify the sender
immediately and do not disclose the contents to any other
person, use it for any purpose, or store or copy the information.

In the event of any technical difficulty with this email, please
contact the sender or [EMAIL PROTECTED]

Microgen Information Management Solutions
http://www.microgen.co.uk
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/


Re: [U2] Help needed about the process being slow

2004-07-13 Thread FFT2001
In a message dated 7/13/2004 7:23:17 AM Pacific Daylight Time, 
[EMAIL PROTECTED] writes:


> In terms of data-
> For writing 1800 records on a file by Universe it takes 3 min. (when C is 
> not
> running)
> For processing 1800 records C process takes very less time (when universe is
> not running)
> 
> But if both processes are running then it takes about 25 mins to complete 
> the
> process.

Ashish have you considered using many type 19 files, not one?
Why not write each row as a seperate file ?
I would think there is some kind of file-open contention going on and this is 
the source of your problem.
Writing each row as a seperate file might correct that.
Will
---
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/