Re: [U2] Trim trailing attributes off records

2012-05-18 Thread Wols Lists
On 16/05/12 19:09, Wjhonson wrote:
> 
> You missed the last sub-part where the *size* of the array actually affects 
> your below.
> In Information flavor
> IF the DIM is smaller than the record, it will write all the trailing 
> attributes back out
> 
> However, IF the DIM is larger than the record, it will *truncate* any 
> trailing attributes
> 
> So it's not quite as clear as what you stated.
> It must do the truncation and THEN add the header perhaps.
> That would explain why, in the *smaller than* example (previously posted in 
> this thread), the reason we still get the trailing attributes writen out, is 
> because the run-time engine has already passed the truncation logic (without 
> doing anything), and then added the header data back on.
> 
> While in the *larger than* example, it truncates, and then writes the data 
> out which is why the trailing attributes vanish.
> 
Actually, I very much doubt the MATWRITE code actually truncates. While
I'm sure it's much smarter than that, I guess the basic logic is

FOR I = 1 TO ELEMENTS
   IF MATARRY(I) NE "" THEN DYNARRAY = MATARRAY
NEXT I

Then the "truncation" and all that just falls out naturally.

Which is why any overflow "breaks" the logic, as the overflow record
contains a bunch of field marks and is not null.

And given that a large chunk of INFORMATION internals was itself written
in INFOBASIC aiui, this seems highly likely.

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


Re: [U2] Trim trailing attributes off records

2012-05-18 Thread Wols Lists
On 16/05/12 19:10, Wjhonson wrote:
> 
> Reality flavor must use the *stuff it all into the end* logic.
> Don't have any Reality flavor accounts here.
> 
> I wonder if when you MATWRITE it, if it will truncate the trailing attributes?
> 
Read up on the different types of arrays.

Pick does NOT have an element (0), and stuffs excess attributes at the end.

INFORMATION has an element (0), and stuffs excess attributes there.
Oddly enough, there is NO element (0,0), even in a two-dimensional array.

Which type of array is used by your program depends on your flavour and
options.

By the way, congratulations on suddenly realising what everybody's been
shouting at you, that MATWRITE *only* strips trailing fields if you
don't have any overflow!

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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Dianne Ackerman
Ran it in Reality flavor, it still works the same way; the DIM needs to 
be large.

-Dianne

On 5/16/2012 2:10 PM, Wjhonson wrote:

Reality flavor must use the *stuff it all into the end* logic.
Don't have any Reality flavor accounts here.

I wonder if when you MATWRITE it, if it will truncate the trailing attributes?








-Original Message-
From: David L. Wasylenko
To: U2 Users List
Sent: Wed, May 16, 2012 11:05 am
Subject: Re: [U2] Trim trailing attributes off records


  RELLEVEL
01 X
02 10.1.23
03 REALITY
04 REALITY.FORMAT
05 10.1.23
... 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 1:05 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] Trim trailing attributes off records
What system are you running?

-Original Message-
rom: David L. Wasylenko
o: U2 Users List
ent: Wed, May 16, 2012 10:56 am
ubject: Re: [U2] Trim trailing attributes off records

've just run a test...
PEN "FILE"...
M REC(100)
TREAD REC FROM FILE...
T REC(1)
T REC(100)
D
LL extra attributes are in REC(100)
.. David...
_
-Users mailing list
-us...@listserver.u2ug.org
tp://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] Trim trailing attributes off records

2012-05-16 Thread Wjhonson

Reality flavor must use the *stuff it all into the end* logic.
Don't have any Reality flavor accounts here.

I wonder if when you MATWRITE it, if it will truncate the trailing attributes?








-Original Message-
From: David L. Wasylenko 
To: U2 Users List 
Sent: Wed, May 16, 2012 11:05 am
Subject: Re: [U2] Trim trailing attributes off records


 RELLEVEL
01 X
02 10.1.23
03 REALITY
04 REALITY.FORMAT
05 10.1.23
... 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 1:05 PM
o: u2-users@listserver.u2ug.org
ubject: Re: [U2] Trim trailing attributes off records
What system are you running?

-Original Message-
rom: David L. Wasylenko 
o: U2 Users List 
ent: Wed, May 16, 2012 10:56 am
ubject: Re: [U2] Trim trailing attributes off records

've just run a test...
PEN "FILE"...
M REC(100)
TREAD REC FROM FILE...
T REC(1)
T REC(100)
D
LL extra attributes are in REC(100)
.. David...
_
-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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Wjhonson

You missed the last sub-part where the *size* of the array actually affects 
your below.
In Information flavor
IF the DIM is smaller than the record, it will write all the trailing 
attributes back out

However, IF the DIM is larger than the record, it will *truncate* any trailing 
attributes

So it's not quite as clear as what you stated.
It must do the truncation and THEN add the header perhaps.
That would explain why, in the *smaller than* example (previously posted in 
this thread), the reason we still get the trailing attributes writen out, is 
because the run-time engine has already passed the truncation logic (without 
doing anything), and then added the header data back on.

While in the *larger than* example, it truncates, and then writes the data out 
which is why the trailing attributes vanish.








-Original Message-
From: Martin Phillips 
To: 'U2 Users List' 
Sent: Wed, May 16, 2012 10:58 am
Subject: Re: [U2] Trim trailing attributes off records


Hi all,
I have missed much of this thread so please ignore my response if it has all 
een said before.
UV supports two types of dimensioned arrays which, for the purpose of this 
iscussion, I will call "Information style" and "Pick
tyle" because of their origins. Which one you get is flavour dependent but, 
ike all these things, you can use $OPTION to change
he default.
An Information style array actually has one element more than you request, the 
ero element, referenced as A(0) or B(0,0). Note that
n the two dimensional case, it is just one element not a whole extra row or 
olumn. The zero element was invented in Prime
nformation to handle the problem of MATREAD finding more fields than there are 
rray elements. The excess data (including any
mbedded field marks) goes into the zero element as a sort of "overflow bucket".
When you do a MATWRITE, the system builds the dynamic array form of the data 
rom the main elements of the array and then adds the
ontent of the zero element on the end.
The effect of this is that a program that reads a record that has more fields 
han expected, and then writes it out again, works
ine so long as the program does not directly touch the zero element.
On the other hand, Pick style dimensioned arrays do not have the zero element. 
ny excess data is included in the final element and
ence, if the program accesses/updates the final element, things are likely to 
o badly wrong. Traditionally, Pick programmers make
ure that the array is at least one element larger than the expected data, 
ffectively moving the overflow bucket to the other end
f the array.
While we are here, and drifting away from the thread topic but still relevant 
to 
imensioned arrays, there is another important
ifference between the two types that can be significant, especially with arrays 
n common blocks.
A Pick style array is simply a series of variables. Thus, if I define a common 
s
  COMMON A, B(3), C
hat I actually get is
  A   B(1)   B(2)   B(3)   C
An Information style array is a pointer to the actual array elements such that 
I 
et
  A   B   C
here B points to 
  B(0)   B(1)   B(2)   B(3)
The significance of this is that the Pick style allows me to do nasty (or 
lever, depending who you ask) things like redefining the
ommon as
  COMMON P(2), Q(3)
n a second program and viewing it differently. I cannot do this with an 
nformation style array.
However, the Information style array has the advantage that I can redimension 
it 
ynamically in my program which I cannot do with
he Pick example above.

artin Phillips
adybridge Systems Ltd
7b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
44 (0)1604-709200

___
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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread David L. Wasylenko
 RELLEVEL
001 X
002 10.1.23
003 REALITY
004 REALITY.FORMAT
005 10.1.23

... david ...

David L. Wasylenko
President, Pick Professionals, Inc
w) 314 558 1482
d...@pickpro.com


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Wednesday, May 16, 2012 1:05 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Trim trailing attributes off records

What system are you running?



-Original Message-
From: David L. Wasylenko 
To: U2 Users List 
Sent: Wed, May 16, 2012 10:56 am
Subject: Re: [U2] Trim trailing attributes off records


I've just run a test...
OPEN "FILE"...
IM REC(100)
ATREAD REC FROM FILE...
RT REC(1)
RT REC(100)
ND
ALL extra attributes are in REC(100)
... David...
__
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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Wjhonson
What system are you running?



-Original Message-
From: David L. Wasylenko 
To: U2 Users List 
Sent: Wed, May 16, 2012 10:56 am
Subject: Re: [U2] Trim trailing attributes off records


I've just run a test...
OPEN "FILE"...
IM REC(100)
ATREAD REC FROM FILE...
RT REC(1)
RT REC(100)
ND
ALL extra attributes are in REC(100)
... David...
__
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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Martin Phillips
Hi all,

I have missed much of this thread so please ignore my response if it has all 
been said before.

UV supports two types of dimensioned arrays which, for the purpose of this 
discussion, I will call "Information style" and "Pick
style" because of their origins. Which one you get is flavour dependent but, 
like all these things, you can use $OPTION to change
the default.

An Information style array actually has one element more than you request, the 
zero element, referenced as A(0) or B(0,0). Note that
in the two dimensional case, it is just one element not a whole extra row or 
column. The zero element was invented in Prime
Information to handle the problem of MATREAD finding more fields than there are 
array elements. The excess data (including any
embedded field marks) goes into the zero element as a sort of "overflow bucket".

When you do a MATWRITE, the system builds the dynamic array form of the data 
from the main elements of the array and then adds the
content of the zero element on the end.

The effect of this is that a program that reads a record that has more fields 
than expected, and then writes it out again, works
fine so long as the program does not directly touch the zero element.

On the other hand, Pick style dimensioned arrays do not have the zero element. 
Any excess data is included in the final element and
hence, if the program accesses/updates the final element, things are likely to 
go badly wrong. Traditionally, Pick programmers make
sure that the array is at least one element larger than the expected data, 
effectively moving the overflow bucket to the other end
of the array.

While we are here, and drifting away from the thread topic but still relevant 
to dimensioned arrays, there is another important
difference between the two types that can be significant, especially with 
arrays in common blocks.

A Pick style array is simply a series of variables. Thus, if I define a common 
as
   COMMON A, B(3), C
what I actually get is
   A   B(1)   B(2)   B(3)   C

An Information style array is a pointer to the actual array elements such that 
I get
   A   B   C
where B points to 
   B(0)   B(1)   B(2)   B(3)

The significance of this is that the Pick style allows me to do nasty (or 
clever, depending who you ask) things like redefining the
common as
   COMMON P(2), Q(3)
in a second program and viewing it differently. I cannot do this with an 
Information style array.

However, the Information style array has the advantage that I can redimension 
it dynamically in my program which I cannot do with
the Pick example above.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200



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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread David L. Wasylenko
I've just run a test...

OPEN "FILE"...
DIM REC(100)
MATREAD REC FROM FILE...
CRT REC(1)
CRT REC(100)
END

ALL extra attributes are in REC(100)

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


Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Wjhonson

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 
To: U2 Users List 
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 
o: U2 Users List 
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
To: U2 Users List
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(3)
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
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
o: u2-users
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
o: u2-users
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), @F

Re: [U2] Trim trailing attributes off records

2012-05-16 Thread David L. Wasylenko
Not if I remember correctly
To prevent lost data, attributes above the DIM size are stuffed as dynamic 
array elements within the last element.

... david ...

David L. Wasylenko
President, Pick Professionals, Inc
w) 314 558 1482
d...@pickpro.com


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Wednesday, May 16, 2012 12:40 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Trim trailing attributes off records


Oh
The DIM has to be *larger* than the attribute size.

How curious.








-Original Message-
From: Dianne Ackerman 
To: U2 Users List 
Sent: Wed, May 16, 2012 10:36 am
Subject: Re: [U2] Trim trailing attributes off records


Will, your code gets the results you're seeing when I try it on UV, but f I 
change your code to have a large DIM of 100, it works the way you ant it to!
Dianne
On 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
 To: U2 Users List
 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  
rray to a record in a UniVerse file. The elements of array replace any data  
tored 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(3)
 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
 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  
xact same problem with which you started.
 xtra empty attributes.
 The solution you already had, to matread it, blank rec(0), then matwrite it  
hat works.




 Original Message-
 rom: Wols Lists
 o: u2-users
 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 
with 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  
twriting didn't work.
 ou have to set Rec(0) to nothing in between  've just realised WHY that 
probably 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 if it's got overflow in it ...
 heers,
 l




 Original Message-
 rom: Wols Lists
 o: u2-users
 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:" contains extra data!"
 o basically, you're dumping what you don't want into element 0. The  nvert 
checks that it really is nothing before zeroing it.
 'm guessing it's 

Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Wjhonson

Oh
The DIM has to be *larger* than the attribute size.

How curious.








-Original Message-
From: Dianne Ackerman 
To: U2 Users List 
Sent: Wed, May 16, 2012 10:36 am
Subject: Re: [U2] Trim trailing attributes off records


Will, your code gets the results you're seeing when I try it on UV, but 
f I change your code to have a large DIM of 100, it works the way you 
ant it to!
Dianne
On 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
 To: U2 Users List
 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
 rray to a record in a UniVerse file. The elements of array replace any data
 tored 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(3)
 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
 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
 xact same problem with which you started.
 xtra empty attributes.
 The solution you already had, to matread it, blank rec(0), then matwrite it
 hat works.




 Original Message-
 rom: Wols Lists
 o: u2-users
 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 with 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
 twriting didn't work.
 ou have to set Rec(0) to nothing in between
 've just realised WHY that probably 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 if it's got overflow in it ...
 heers,
 l




 Original Message-
 rom: Wols Lists
 o: u2-users
 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:" contains extra data!"
 o basically, you're dumping what you don't want into element 0. The
 nvert checks that it really is nothing before zeroing it.
 'm guessing it's not working for you because somehow there are actually
 aces in those fields you think are blank (ED gets rid of trailing
 aces ...)
 ou can pull the same stunt for PICK mode, just remember the extra
 tries will end up in the last element of the array.
 heers,
 l



   -Original Message-
   From: andy baum
   To: U2 Users List
   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 ope

Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Dianne Ackerman
Will, your code gets the results you're seeing when I try it on UV, but 
if I change your code to have a large DIM of 100, it works the way you 
want it to!

-Dianne

On 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
To: U2 Users List
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
rray to a record in a UniVerse file. The elements of array replace any data
tored in the record. MATWRITE strips any trailing empty fields from the record.

've run the following code in every flavor account on UV 10.3

CT BP TEST.MATWRITE
TEST.MATWRITE
001 DIM REC(3)
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
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
xact same problem with which you started.
xtra empty attributes.
The solution you already had, to matread it, blank rec(0), then matwrite it
hat works.




Original Message-
rom: Wols Lists
o: u2-users
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 with 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
twriting didn't work.
ou have to set Rec(0) to nothing in between
've just realised WHY that probably 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 if it's got overflow in it ...
heers,
l




Original Message-
rom: Wols Lists
o: u2-users
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:" contains extra data!"
o basically, you're dumping what you don't want into element 0. The
nvert checks that it really is nothing before zeroing it.
'm guessing it's not working for you because somehow there are actually
aces in those fields you think are blank (ED gets rid of trailing
aces ...)
ou can pull the same stunt for PICK mode, just remember the extra
tries will end up in the last element of the array.
heers,
l



  -Original Message-
  From: andy baum
  To: U2 Users List
  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
  o: u2-users@listserver.u2ug.org
  ent: Thursday, 10 May 2012, 23:13
  ubject: [U2]  Trim traili

Re: [U2] Trim trailing attributes off records

2012-05-16 Thread Wjhonson

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 
To: U2 Users List 
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 
rray to a record in a UniVerse file. The elements of array replace any data 
tored in the record. MATWRITE strips any trailing empty fields from the record.

've run the following code in every flavor account on UV 10.3

CT BP TEST.MATWRITE
TEST.MATWRITE
001 DIM REC(3)
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 
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 
xact same problem with which you started.
xtra empty attributes.
The solution you already had, to matread it, blank rec(0), then matwrite it
hat works.




Original Message-
rom: Wols Lists 
o: u2-users 
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 with 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 
twriting didn't work.
ou have to set Rec(0) to nothing in between
've just realised WHY that probably 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 if it's got overflow in it ...
heers,
l




Original Message-
rom: Wols Lists 
o: u2-users 
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:" contains extra data!"
o basically, you're dumping what you don't want into element 0. The
nvert checks that it really is nothing before zeroing it.
'm guessing it's not working for you because somehow there are actually
aces in those fields you think are blank (ED gets rid of trailing
aces ...)
ou can pull the same stunt for PICK mode, just remember the extra
tries will end up in the last element of the array.
heers,
l

 
 
 -Original Message-
 From: andy baum 
 To: U2 Users List 
 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 
 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 a

Re: [U2] Trim trailing attributes off records

2012-05-16 Thread andy baum
The manual states :-


Description
Use the MATWRITE statement to write data from the elements of a dimensioned 
array to a record in a UniVerse file. The elements of array replace any data 
stored in the record. MATWRITE strips any trailing empty fields from the record.


I've run the following code in every flavor account on UV 10.3


>CT BP TEST.MATWRITE

TEST.MATWRITE
0001         DIM REC(3)
0002         OPEN '','VOC' TO VOC THEN
0003           MATREAD REC FROM VOC,'MW' THEN
0004             MATWRITE REC TO VOC,'MW'
0005           END
0006         END
0007   END 

And get the following results

Before

>CT VOC MW

MW
0001 FIELD 1
0002
0003 FIELD 3
0004
0005
0006
0007
0008
0009
0010

>RUN BP TEST.MATWRITE


After

>CT VOC MW

MW
0001 FIELD 1
0002
0003 FIELD 3
>






 From: Wjhonson 
To: u2-users@listserver.u2ug.org 
Sent: Wednesday, 16 May 2012, 2:51
Subject: Re: [U2] Trim trailing attributes off records
 

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 
To: u2-users 
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 
To: u2-users 
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 
  To: U2 Users List 
  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 
  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
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Trim trailing attributes off records

2012-05-15 Thread Wjhonson

 There's nothing I can do as far as I know about how the AOL email creator, and 
... whatever.. interact.

As far as quoting, it's an automatic function, I'm not *doing* anything to make 
it happen, it happens all on it's own.

 

 

-Original Message-
From: Tony Gravagno <3xk547...@sneakemail.com>
To: u2-users 
Sent: Tue, May 15, 2012 8:39 pm
Subject: Re: [U2] Trim trailing attributes off records


I know functional code was posted last week so I'm amazed that this
thread is still alive. I'll just add that in D3 we can do this:

matread dimrec from fv,key else null
dynrec =  dimrec
write dynrec on fv,key

Perhaps non-intuitively, the assignment of a dimensioned array to a
non-dimensioned variable not only creates a dynamic array, but
automatically truncates trailing attributes. It's the equivalent to
matbuild, which I believe by default also truncates. I thought the
same behaviour was standard in U2, haven't checked sorry.

T

(PS : Hey Wil, doesn't it irritate you that your quoted text is
usually missing the first character of every line? You're the only
person on the planet that seems to have this problem. Someone
commented on it here a while back. How about doing something about
that? If you quote code it gets corrupted, so what's the point?)

___
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] Trim trailing attributes off records

2012-05-15 Thread David L. Wasylenko
That's a slick solution --- I do believe truncating a dim write is universal.

Amen on the truncated !

... david ...

David L. Wasylenko
President, Pick Professionals, Inc
w) 314 558 1482
d...@pickpro.com


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno
Sent: Tuesday, May 15, 2012 10:39 PM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Trim trailing attributes off records

I know functional code was posted last week so I'm amazed that this thread is 
still alive. I'll just add that in D3 we can do this:

matread dimrec from fv,key else null
dynrec =  dimrec
write dynrec on fv,key

Perhaps non-intuitively, the assignment of a dimensioned array to a 
non-dimensioned variable not only creates a dynamic array, but automatically 
truncates trailing attributes. It's the equivalent to matbuild, which I believe 
by default also truncates. I thought the same behaviour was standard in U2, 
haven't checked sorry.

T

(PS : Hey Wil, doesn't it irritate you that your quoted text is usually missing 
the first character of every line? You're the only person on the planet that 
seems to have this problem. Someone commented on it here a while back. How 
about doing something about that? If you quote code it gets corrupted, so 
what's the point?)

___
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] Trim trailing attributes off records

2012-05-15 Thread Tony Gravagno
I know functional code was posted last week so I'm amazed that this
thread is still alive. I'll just add that in D3 we can do this:

matread dimrec from fv,key else null
dynrec =  dimrec
write dynrec on fv,key

Perhaps non-intuitively, the assignment of a dimensioned array to a
non-dimensioned variable not only creates a dynamic array, but
automatically truncates trailing attributes. It's the equivalent to
matbuild, which I believe by default also truncates. I thought the
same behaviour was standard in U2, haven't checked sorry.

T

(PS : Hey Wil, doesn't it irritate you that your quoted text is
usually missing the first character of every line? You're the only
person on the planet that seems to have this problem. Someone
commented on it here a while back. How about doing something about
that? If you quote code it gets corrupted, so what's the point?)

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


Re: [U2] Trim trailing attributes off records

2012-05-15 Thread Wjhonson

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 
To: u2-users 
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 
 To: u2-users 
 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 
  To: U2 Users List 
  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 
  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


Re: [U2] Trim trailing attributes off records

2012-05-15 Thread Wols Lists
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 
> marks 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 
> matwriting 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
empty, and if it's got overflow in it ...

Cheers,
Wol
> 
> 
> 
> 
> 
> 
> 
> 
> -Original Message-
> From: Wols Lists 
> To: u2-users 
> 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" 
> and 
> 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 
>  To: U2 Users List 
>  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 
>  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?
>  __
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Trim trailing attributes off records

2012-05-15 Thread Wjhonson

Information Flavor
No spaces in the fields, nothing in them at all, just a line of attribute marks 
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 
matwriting didn't work.
You have to set Rec(0) to nothing in between








-Original Message-
From: Wols Lists 
To: u2-users 
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" and 
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 
 To: U2 Users List 
 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 
 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


Re: [U2] Trim trailing attributes off records

2012-05-15 Thread Wols Lists
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" 
> and then append them back to the record when it writes it out.
> Universe 10.3
> 
What 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 ...
Declare your MAT as 20 long :-)
Add 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
convert checks that it really is nothing before zeroing it.

I'm guessing it's not working for you because somehow there are actually
spaces in those fields you think are blank (ED gets rid of trailing
spaces ...)

You can pull the same stunt for PICK mode, just remember the extra
entries will end up in the last element of the array.

Cheers,
Wol

> 
> 
> 
> -----Original Message-----
> From: andy baum 
> To: U2 Users List 
> 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 
> 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?
> __
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Trim trailing attributes off records

2012-05-11 Thread Wjhonson

I thought that too.
Tried that one.
What it actually does is store all the trailing attributes in the "header" and 
then append them back to the record when it writes it out.
Universe 10.3




-Original Message-
From: andy baum 
To: U2 Users List 
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 
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
__
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


Re: [U2] Trim trailing attributes off records

2012-05-11 Thread andy baum
How about :-

OPEN 'FILENAME' TO FILEVAR ELSE
    STOPM 'Cannot open FILENAME'

END


DIM REC(500)


SELECT FILEVAR

LOOP

WHILE READNEXT ID

   MATREADU REC FROM FILEVAR,ID THEN

      MATWRITE REC TO FILEVAR,ID

   END

REPEAT


END


MATWRITE trims trailing blank attributes as it writes the data away


Cheers,

Andy





From: Wjhonson 
To: u2-users@listserver.u2ug.org 
Sent: Thursday, 10 May 2012, 23:13
Subject: [U2]  Trim trailing attributes off records
 


Given that you have a file with thousands of records, each with dozens of 
trailing attributes which are empty.

How can you pick up the file and drop it back down with all those empties 
trimmed off?
___
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] Trim trailing attributes off records

2012-05-10 Thread Wjhonson

Oh I see TRIM with a T
I never would have thought of that solution.
Thanks









-Original Message-
From: David L. Wasylenko 
To: U2 Users List 
Sent: Thu, May 10, 2012 3:27 pm
Subject: Re: [U2] Trim trailing attributes off records


FILE.LIST="CUSTOMER"
ILE.LIST<-1>="..."
ILE.LIST<-1>="..."

.CNT=DCOUNT(FILE.LIST,@AM)
OR F.PTR=1 TO F.CNT
F.NAME=FILE.LIST
OPEN F.NAME TO FILE.HANDLE THEN
GOSUB H.PROCESS
END ELSE
CRT "Cannot open file '":F.NAME:"'."
END
EXT F.PTR
TOP

.PROCESS:*

ELECT FILE.HANDLE
OOP WHILE READNEXT ID
READU REC FROM FILE.HANDLE, ID LOCKED
... handle locked record, or skip
END THEN
REC=TRIM(REC,@AM,"T")
WRITE REC ON FILE.HANDLE, ID
END ELSE
... handle missing record
RELEASE FILE.HANDLE, ID
END
EPEAT

ETURN

 end of job

do your own checking of this ad-hoc, untested method)
... david ...
David L. Wasylenko
resident, Pick Professionals, Inc

Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Bill Brutzman
ent: Thursday, May 10, 2012 5:21 PM
o: U2 Users List
ubject: Re: [U2] Trim trailing attributes off records
I would write a little uniBasic program... to cleanse, purify, and rehydrate... 
esting it first in a sandbox.
--Bill
-Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Thursday, May 10, 2012 6:13 PM
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
__
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


Re: [U2] Trim trailing attributes off records

2012-05-10 Thread Wjhonson
I think there must be a trick way to do it.



-Original Message-
From: Bill Brutzman 
To: U2 Users List 
Sent: Thu, May 10, 2012 3:22 pm
Subject: Re: [U2] Trim trailing attributes off records


I would write a little uniBasic program... to cleanse, purify, and rehydrate... 
esting it first in a sandbox.
--Bill
-Original Message-
rom: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] 
n Behalf Of Wjhonson
ent: Thursday, May 10, 2012 6:13 PM
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


Re: [U2] Trim trailing attributes off records

2012-05-10 Thread David L. Wasylenko
FILE.LIST="CUSTOMER"
FILE.LIST<-1>="..."
FILE.LIST<-1>="..."
*
F.CNT=DCOUNT(FILE.LIST,@AM)
FOR F.PTR=1 TO F.CNT
F.NAME=FILE.LIST
OPEN F.NAME TO FILE.HANDLE THEN
GOSUB H.PROCESS
END ELSE
CRT "Cannot open file '":F.NAME:"'."
END
NEXT F.PTR
STOP
*
H.PROCESS:*
*
SELECT FILE.HANDLE
LOOP WHILE READNEXT ID
READU REC FROM FILE.HANDLE, ID LOCKED
... handle locked record, or skip
END THEN
REC=TRIM(REC,@AM,"T")
WRITE REC ON FILE.HANDLE, ID
END ELSE
... handle missing record
RELEASE FILE.HANDLE, ID
END
REPEAT
*
RETURN
*
* end of job
*
(do your own checking of this ad-hoc, untested method)

... david ...

David L. Wasylenko
President, Pick Professionals, Inc


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
Sent: Thursday, May 10, 2012 5:21 PM
To: U2 Users List
Subject: Re: [U2] Trim trailing attributes off records

I would write a little uniBasic program... to cleanse, purify, and rehydrate... 
testing it first in a sandbox.

--Bill

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, May 10, 2012 6:13 PM
Subject: [U2] Trim trailing attributes off records


Given that you have a file with thousands of records, each with dozens of 
trailing attributes which are empty.

How can you pick up the file and drop it back down with all those empties 
trimmed off?
___
___
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] Trim trailing attributes off records

2012-05-10 Thread David Wolverton
Why even do it?  The 50 bytes of storage are worth the effort?  Usually, I
prefer to have attibutes 'all the way' to the full definition of a file --
makes it easier to 'prestore' when needed!  It's a pain when you need to
'prestore' data into attribute 200, but the record stops at 185 because
those other fields were blank!

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Bill Brutzman
Sent: Thursday, May 10, 2012 5:21 PM
To: U2 Users List
Subject: Re: [U2] Trim trailing attributes off records

I would write a little uniBasic program... to cleanse, purify, and
rehydrate... testing it first in a sandbox.

--Bill

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, May 10, 2012 6:13 PM
Subject: [U2] Trim trailing attributes off records


Given that you have a file with thousands of records, each with dozens of
trailing attributes which are empty.

How can you pick up the file and drop it back down with all those empties
trimmed off?
___
___
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] Trim trailing attributes off records

2012-05-10 Thread Bill Brutzman
I would write a little uniBasic program... to cleanse, purify, and rehydrate... 
testing it first in a sandbox.

--Bill

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Thursday, May 10, 2012 6:13 PM
Subject: [U2] Trim trailing attributes off records


Given that you have a file with thousands of records, each with dozens of 
trailing attributes which are empty.

How can you pick up the file and drop it back down with all those empties 
trimmed off?
___
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


[U2] Trim trailing attributes off records

2012-05-10 Thread Wjhonson

Given that you have a file with thousands of records, each with dozens of 
trailing attributes which are empty.

How can you pick up the file and drop it back down with all those empties 
trimmed off?
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users