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. <[email protected]> To: U2 Users List <[email protected]> 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: [email protected] [mailto:[email protected]] 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),<AT>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.YYYY, KEY.TXT TXT.REC=TXT.REC LOOP REMOVE ROW FROM TXT.REC SETTING POS UNTIL ROW='' AND POS=0 ROW=CONVERT(CHAR(9),<AT>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: [email protected] [mailto:[email protected]] On Behalf Of Sathya Sent: Tuesday, May 07, 2013 12:36 AM To: [email protected] Subject: Re: [U2] Help needed.. Wjhonson <wjhonson <at> 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. <JohnIsrael <at> daytonsuperior.com> > To: 'U2 Users List' <u2-users <at> 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.YYYY, 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 <at> 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 <at> listserver.u2ug.org [mailto:u2-users-bounces <at> listserver.u2ug.org] > On Behalf Of Sathya > Sent: Tuesday, April 30, 2013 11:21 AM > To: u2-users <at> 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 <at> listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > _______________________________________________ > U2-Users mailing list > U2-Users <at> listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > > > _______________________________________________ > U2-Users mailing list > U2-Users <at> listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > > _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
