Sure but then *that* will not trim the trailing attributes.....
If you dim it to hold every element, and then write it back you just get the 
exact same problem with which you started.
Extra empty attributes.

The solution you already had, to matread it, blank rec(0), then matwrite it
That works.








-----Original Message-----
From: Wols Lists <antli...@youngman.org.uk>
To: u2-users <u2-users@listserver.u2ug.org>
Sent: Tue, May 15, 2012 5:59 pm
Subject: Re: [U2] Trim trailing attributes off records


On 15/05/12 20:50, Wjhonson wrote:
 
 Information Flavor
 No spaces in the fields, nothing in them at all, just a line of attribute 
arks with nothing in between.
 Your trick below *does* work by the way, and it's essentially what I did.
 I just set Rec(0) to nothing before the MATWRITE and that did it.
 
 But I was also surprised that Andy's trick of just matreading and then 
atwriting didn't work.
 You have to set Rec(0) to nothing in between
I've just realised WHY that probably is ... Rec(0) is full of FMs ...
If you dimension your array to hold every element of the record
without* overflow, it'll work fine. I bet the MATWRITE tests if (0) is
mpty, and if it's got overflow in it ...
Cheers,
ol
 
 
 
 
 
 
 
 
 -----Original Message-----
 From: Wols Lists <antli...@youngman.org.uk>
 To: u2-users <u2-users@listserver.u2ug.org>
 Sent: Tue, May 15, 2012 12:40 pm
 Subject: Re: [U2] Trim trailing attributes off records
 
 
 On 11/05/12 17:36, Wjhonson wrote:
  
  I thought that too.
  Tried that one.
  What it actually does is store all the trailing attributes in the "header" 
nd 
 hen append them back to the record when it writes it out.
  Universe 10.3
  
 hat flavour? That ALWAYS worked for me on PI.
 Let's say your dict declares up to, say, field 20 and you know there
 shouldn't* be anything beyond it.
 Sounds actually, like you are in PI mode so ...
 eclare your MAT as 20 long :-)
 dd a line before the write which says
 IF CONVERT( REC(0), @FM:" ", "") EQ "" THEN REC(0) = "" ELSE PRINT
 Record ":ID:" contains extra data!"
 So basically, you're dumping what you don't want into element 0. The
 onvert checks that it really is nothing before zeroing it.
 I'm guessing it's not working for you because somehow there are actually
 paces in those fields you think are blank (ED gets rid of trailing
 paces ...)
 You can pull the same stunt for PICK mode, just remember the extra
 ntries will end up in the last element of the array.
 Cheers,
 ol
>
  
  
  -----Original Message-----
  From: andy baum <andyb...@yahoo.co.uk>
  To: U2 Users List <u2-users@listserver.u2ug.org>
  Sent: Fri, May 11, 2012 6:30 am
  Subject: Re: [U2] Trim trailing attributes off records
  
  
  How about :-
  OPEN 'FILENAME' TO FILEVAR ELSE
     STOPM 'Cannot open FILENAME'
  END
  
  IM REC(500)
  
  ELECT FILEVAR
  LOOP
  WHILE READNEXT ID
     MATREADU REC FROM FILEVAR,ID THEN
        MATWRITE REC TO FILEVAR,ID
     END
  REPEAT
  
  ND
  
  ATWRITE trims trailing blank attributes as it writes the data away
  
  heers,
  Andy
  
  
  From: Wjhonson <wjhon...@aol.com>
  o: u2-users@listserver.u2ug.org 
  ent: Thursday, 10 May 2012, 23:13
  ubject: [U2]  Trim trailing attributes off records
  
  
  iven that you have a file with thousands of records, each with dozens of 
  railing attributes which are empty.
  How can you pick up the file and drop it back down with all those empties 
  rimmed off?
  __
______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users

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

Reply via email to