Universe puts the extra ones into the header, and then writes them back out if 
the array is *smaller*
You have to read back in this thread where we covered that point.

However, stuffing the extras into the *last* element *was* how the Ultimate 
system used to work. (Maybe Ult-Plus still does?)



-----Original Message-----
From: David L. Wasylenko <d...@pickpro.com>
To: U2 Users List <u2-users@listserver.u2ug.org>
Sent: Wed, May 16, 2012 10:41 am
Subject: Re: [U2] Trim trailing attributes off records


Not if I remember correctly....
o prevent lost data, attributes above the DIM size are stuffed as dynamic array 
lements within the last element.
... david ...
David L. Wasylenko
resident, Pick Professionals, Inc
) 314 558 1482
l...@pickpro.com

----Original Message-----
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Wednesday, May 16, 2012 12:40 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] Trim trailing attributes off records

h....
he DIM has to be *larger* than the attribute size.....
How curious.




----Original Message-----
rom: Dianne Ackerman <dia...@aptron.com>
o: U2 Users List <u2-users@listserver.u2ug.org>
ent: Wed, May 16, 2012 10:36 am
ubject: Re: [U2] Trim trailing attributes off records

ill, your code gets the results you're seeing when I try it on UV, but f I 
hange your code to have a large DIM of 100, it works the way you ant it to!
ianne
n 5/16/2012 12:40 PM, Wjhonson wrote:
0001:       OPEN "VOC" TO F.VOC ELSE STOP
0002:       A = "DOG":@AM:@AM:@AM:@AM
0003:       PRINT CONVERT(@AM,"!",A)
0004:       WRITE A ON F.VOC,"DOG"
0005:       READ B FROM F.VOC,"DOG" ELSE B = ''
0006:       PRINT CONVERT(@AM,"!",B)
0007: *
0008:       DIM R.DOG(1)
0009:       MATREAD R.DOG FROM F.VOC,"DOG" THEN
0010:          MATWRITE R.DOG ON F.VOC,"DOG"
0011:       END
0012:       READ C FROM F.VOC,"DOG" THEN
0013:          PRINT CONVERT(@AM,"!",C)
0014:       END
 Result:
 DOG!!!!
DOG!!!!
DOG!!!!

 -----Original Message-----
From: andy baum<andyb...@yahoo.co.uk>
To: U2 Users List<u2-users@listserver.u2ug.org>
Sent: Wed, May 16, 2012 12:34 am
Subject: Re: [U2] Trim trailing attributes off records

The manual states :-
 escription
se the MATWRITE statement to write data from the elements of a dimensioned  
ray to a record in a UniVerse file. The elements of array replace any data  
ored in the record. MATWRITE strips any trailing empty fields from the ecord.
 've run the following code in every flavor account on UV 10.3
 CT BP TEST.MATWRITE
TEST.MATWRITE
001             DIM REC(30000)
002             OPEN '','VOC' TO VOC THEN
003                   MATREAD REC FROM VOC,'MW' THEN
004                         MATWRITE REC TO VOC,'MW'
005                   END
006             END
007       END
And get the following results
Before
 CT VOC MW
MW
001 FIELD 1
002
003 FIELD 3
004
005
006
007
008
009
010
 RUN BP TEST.MATWRITE
fter
 CT VOC MW
MW
001 FIELD 1
002
003 FIELD 3

 ________________________________
From: Wjhonson<wjhon...@aol.com>
o: u2-users@listserver.u2ug.org
ent: Wednesday, 16 May 2012, 2:51
ubject: Re: [U2] Trim trailing attributes off records
 Sure but then *that* will not trim the trailing attributes.....
f you dim it to hold every element, and then write it back you just get the  
act same problem with which you started.
xtra empty attributes.
The solution you already had, to matread it, blank rec(0), then matwrite it  
at works.


----Original Message-----
rom: Wols Lists<antli...@youngman.org.uk>
o: u2-users<u2-users@listserver.u2ug.org>
ent: Tue, May 15, 2012 5:59 pm
ubject: Re: [U2] Trim trailing attributes off records
 n 15/05/12 20:50, Wjhonson wrote:
Information Flavor
o spaces in the fields, nothing in them at all, just a line of attribute  rks 
ith nothing in between.
our trick below *does* work by the way, and it's essentially what I did.
  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  
writing didn't work.
ou have to set Rec(0) to nothing in between  've just realised WHY that 
robably is ... Rec(0) is full of FMs ...
f you dimension your array to hold every element of the record
ithout* overflow, it'll work fine. I bet the MATWRITE tests if (0) is  pty, and 
f it's got overflow in it ...
heers,
l


----Original Message-----
rom: Wols Lists<antli...@youngman.org.uk>
o: u2-users<u2-users@listserver.u2ug.org>
ent: Tue, May 15, 2012 12:40 pm
ubject: Re: [U2] Trim trailing attributes off records
 n 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"
d
en append them back to the record when it writes it out.
  Universe 10.3
 at flavour? That ALWAYS worked for me on PI.
et's say your dict declares up to, say, field 20 and you know there
houldn't* be anything beyond it.
ounds actually, like you are in PI mode so ...
clare your MAT as 20 long :-)
d a line before the write which says
F CONVERT( REC(0), @FM:" ", "") EQ "" THEN REC(0) = "" ELSE PRINT  ecord ":ID:" 
ontains extra data!"
o basically, you're dumping what you don't want into element 0. The  nvert 
hecks that it really is nothing before zeroing it.
'm guessing it's not working for you because somehow there are actually  aces 
n those fields you think are blank (ED gets rid of trailing  aces ...)  ou can 
ull the same stunt for PICK mode, just remember the extra  tries will end up in 
he last element of the array.
heers,
l

   -----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?
  __
_____________________________________________
-Users mailing list
-us...@listserver.u2ug.org
tp://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users
______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users
 _______________________________________________
______________________________________________
-Users mailing list
-us...@listserver.u2ug.org
tp://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
2-Users mailing list
2-us...@listserver.u2ug.org
ttp://listserver.u2ug.org/mailman/listinfo/u2-users
______________________________________________
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