Re: [U2] Trim trailing attributes off records
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 wjhon...@aol.com 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 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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] [UV] Connecting to a WebService with UV using Authentication Certificate
UniVerse also has ways of interfacing with a proxy. I do not have access to the code at the moment ... 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 John Jenkins Sent: Tuesday, May 15, 2012 5:58 PM To: Jacques G.; U2 Users List Cc: U2 Users List Subject: Re: [U2] [UV] Connecting to a WebService with UV using Authentication Certificate UniVerse has BASIC API extensions that support calling http with secure sockets. I suspect this will do the job for you if the web service is exposed. Regards JayJay Sent from my iPad On 15 May 2012, at 15:14, Jacques G. jacque...@yahoo.com wrote: Hello, A need has come up where I work to connect to a web service using Universe however the Webservice needs a Authentification Certificate. Is there any way to do this all with Universe or does one need to make use of Java on the UV server ? (Are there any examples available that do something like this ?) Jacques G. ___ 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] Trim trailing attributes off records
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 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 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 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 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 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 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: 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 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
Re: [U2] Trim trailing attributes off records
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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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 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: Wjhonsonwjhon...@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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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: 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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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: Wjhonsonwjhon...@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
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 dia...@aptron.com To: U2 Users List u2-users@listserver.u2ug.org 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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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 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: Wjhonsonwjhon...@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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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: 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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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
Re: [U2] Trim trailing attributes off records
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 dia...@aptron.com To: U2 Users List u2-users@listserver.u2ug.org 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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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 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: Wjhonsonwjhon...@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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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 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 Listsantli...@youngman.org.uk o: u2-usersu2-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: 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
Re: [U2] Trim trailing attributes off records
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 baumandyb...@yahoo.co.uk To: U2 Users Listu2-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(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: Wjhonsonwjhon...@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 Listsantli...@youngman.org.uk o: u2-usersu2-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 Listsantli...@youngman.org.uk o: u2-usersu2-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
Re: [U2] Trim trailing attributes off records
What system are you running? -Original Message- From: David L. Wasylenko d...@pickpro.com To: U2 Users List u2-users@listserver.u2ug.org 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
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 d...@pickpro.com To: U2 Users List u2-users@listserver.u2ug.org 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
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 martinphill...@ladybridge.com To: 'U2 Users List' u2-users@listserver.u2ug.org 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
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 d...@pickpro.com To: U2 Users List u2-users@listserver.u2ug.org 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 d...@pickpro.com o: U2 Users List u2-users@listserver.u2ug.org 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
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. Wasylenkod...@pickpro.com To: U2 Users Listu2-users@listserver.u2ug.org 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. Wasylenkod...@pickpro.com o: U2 Users Listu2-users@listserver.u2ug.org 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