Re: [U2] Stumped with TRANS...
DesignBais does all that too. They've built a framework that is used by the developer to ensure variables are available between connections for each session. Very handy! :-) Bill DavidJMurray (mvdbs.com) said the following on 10/18/2010 7:24 PM: phil walker-2 wrote: The trouble with using common for things is when you get into client/server development. You cannot guarantee the common will be available to you. Yes, it can get rather messy keeping track of individual user sessions when a common background process(s) does the heavy lifting, but I thought that THE 'RedBack' thingy did all that magic? Or whatever it is now called - U2 WDE? Cheers, David J Murray - Learn and Do Excel and Share http://mvdbs.com http://mvdbs.com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
phil walker-2 wrote: > > The trouble with using common for things is when you get into > client/server development. You cannot guarantee the common will be > available to you. > > > Yes, it can get rather messy keeping track of individual user sessions when a common background process(s) does the heavy lifting, but I thought that THE 'RedBack' thingy did all that magic? Or whatever it is now called - U2 WDE? Cheers, David J Murray - Learn and Do Excel and Share http://mvdbs.com http://mvdbs.com -- View this message in context: http://old.nabble.com/Stumped-with-TRANS...-tp29910397p29996429.html Sent from the U2 - Users mailing list archive at Nabble.com. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
The trouble with using common for things is when you get into client/server development. You cannot guarantee the common will be available to you. > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of DavidJMurray (mvdbs.com) > Sent: Tuesday, 19 October 2010 2:45 p.m. > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > > > phil walker-2 wrote: > > > > Universe does some caching around TRANS from memory. So if you want > to > > only do lookups your results may indicate a good solution. However, > > for update it will not work, and depending on the number of files > > being accessed, you may find there are issues with the cache being > > rotated. > > > > > > > > Yes, I also believe that there is file caching for the TRANS. I thought that > where was a UniVerse parameter for tuning the memory allocation etc.? > > Like most things, the programming philosophy and techniques has to be > supported by the system settings. > > As a side issue, there are also a series of routines within UniVerse itself (no > SB+) for doing file open caching - see > http://mvdbs.com/2007/11/05/appprogs-open-tools/ > http://mvdbs.com/2007/11/05/appprogs-open-tools/ > > Cheers, > > David J Murray > > > - > > Learn and Do > Excel and Share > > > http://mvdbs.com http://mvdbs.com > -- > View this message in context: http://old.nabble.com/Stumped-with- > TRANS...-tp29910397p29996275.html > Sent from the U2 - Users mailing list archive at Nabble.com. > > ___ > 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] Stumped with TRANS...
phil walker-2 wrote: > > Universe does some caching around TRANS from memory. So if you want to > only do lookups your results may indicate a good solution. However, for > update it will not work, and depending on the number of files being > accessed, you may find there are issues with the cache being > rotated. > > > Yes, I also believe that there is file caching for the TRANS. I thought that where was a UniVerse parameter for tuning the memory allocation etc.? Like most things, the programming philosophy and techniques has to be supported by the system settings. As a side issue, there are also a series of routines within UniVerse itself (no SB+) for doing file open caching - see http://mvdbs.com/2007/11/05/appprogs-open-tools/ http://mvdbs.com/2007/11/05/appprogs-open-tools/ Cheers, David J Murray - Learn and Do Excel and Share http://mvdbs.com http://mvdbs.com -- View this message in context: http://old.nabble.com/Stumped-with-TRANS...-tp29910397p29996275.html Sent from the U2 - Users mailing list archive at Nabble.com. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
Universe does some caching around TRANS from memory. So if you want to only do lookups your results may indicate a good solution. However, for update it will not work, and depending on the number of files being accessed, you may find there are issues with the cache being rotated. > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of DavidJMurray (mvdbs.com) > Sent: Tuesday, 19 October 2010 1:01 p.m. > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > > > FFT2001 wrote: > > > > Has anyone done a timing test to compare a SUBR which uses a common > > section to store an opened file variable > > > > vs a TRANS ? > > ___ > > U2-Users mailing list > > U2-Users@listserver.u2ug.org > > http://listserver.u2ug.org/mailman/listinfo/u2-users > > > > > > I did a simple timing and comparison test some time ago: > > http://mvdbs.com/2006/01/25/timing-trans-and-read/ > http://mvdbs.com/2006/01/25/timing-trans-and-read/ > > Cheers, > > David J Murray > > > - > > Learn and Do > Excel and Share > > > http://mvdbs.com http://mvdbs.com > -- > View this message in context: http://old.nabble.com/Stumped-with- > TRANS...-tp29910397p29995851.html > Sent from the U2 - Users mailing list archive at Nabble.com. > > ___ > 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] Stumped with TRANS...
FFT2001 wrote: > > Has anyone done a timing test to compare a SUBR which uses a common > section > to store an opened file variable > > vs a TRANS ? > ___ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > > I did a simple timing and comparison test some time ago: http://mvdbs.com/2006/01/25/timing-trans-and-read/ http://mvdbs.com/2006/01/25/timing-trans-and-read/ Cheers, David J Murray - Learn and Do Excel and Share http://mvdbs.com http://mvdbs.com -- View this message in context: http://old.nabble.com/Stumped-with-TRANS...-tp29910397p29995851.html Sent from the U2 - Users mailing list archive at Nabble.com. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
Yes, with OPEN/READ setup, there is no issue. With the TRANS setup, I'm forced to do a double TRANS (since I need more than just the @ID and <1>), One TRANS for the data, and another to verify existance if the data is "" I preferred to use the TRANS over OPEN/READ because it was easier to code for dynamicly changing filenames. But with ease comes issues. I had to convert this over to an OPEN statement, and a READ. It's not really an issue any moreand wouldn't have been an issue had there not been a chance that <1> could = the @ID, then it would have worked as expected. George ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
George: As mentioned earlier, doing a "OCONV('RecordKey', 'TFileName;X;;0')" will either return a null string if the item doesn't exist or the RecordKey if it does exist. This seems simple enough. However, I'm running UD v7.2.7. 2 Dev (0)-> BPTEST CRT OCONV('BILL.TEST', 'TVOC;X;;0') ; END Compiling Unibasic: SAVEDLISTS\BpTest_506878981 in mode 'p'. compilation finished 2 Dev (0)-> AE VOC BILL.TEST Top of New "BILL.TEST" in "VOC". *--: FI Filed "BILL.TEST" in file "VOC" empty record created. 2 Dev (0)-> BPTEST CRT OCONV('BILL.TEST', 'TVOC;X;;0') ; END Compiling Unibasic: SAVEDLISTS\BpTest_507019381 in mode 'p'. compilation finished BILL.TEST After converting from D3 this is a really cool feature, and works in BASIC where: READV DoesExist FROM SOMEFILE, SOMEID, 0 ELSE NULL ...sets DoesExist to 1 if it exists and to 0 if it doesn't. This should resolve your issue. HTH, Bill George Gallen said the following on 10/11/2010 1:13 PM: If you a 'C' instead of using 'X' TRANS returns the @ID if the read was unsuccessful, my only problem with this was that on occaision my data was the same as the @ID, so I couldn't differential between the bad read response from TRANS and a good read with data = @ID I suppose, I could read the whole record, and only if data = @ID do a second read wouldn't be too expensive, since it's quite a minority of the time that would happen. But either way, 'X' or 'C', unless I actually do an OPEN/READ it will require a double TRANS to clarify. George -Original Message----- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- boun...@listserver.u2ug.org] On Behalf Of Rick Nuckolls Sent: Monday, October 11, 2010 4:06 PM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... I do not think that there is a way to test the result of a TRANS to discover if the read succeeded or was not found. So, that would leave the slightly flawed options of a) calling a subroutine or b) using the itype below (though it does have a problem with a record id of "", or a value in F1 of 'not found'). What did you want to happen if the record is not on file? I doubt that you would, in practice, find much penalty for doing the TRANS twice on the same record. Example for a dictionary: TRANS(transfile, @ID,@ID,'X'); IF @ = '' THEN 'not found' ELSE TRANS( transfile, @ID, F1,'X') For Basic: VALUE = TRANS("TRANSFILE", id, 1, "X") IF VALUE = "" THEN IF TRANS("TRANSFILE", id, 0, "X") = "" THEN VALUE = "not found" END END But ultimately, either one is flawed if the key is blank. Is there some reason why you do not want to open the file to named common? COMMON /MYSUB/ MYTIME, MYFILE IF (MYTIME # @TIME ) THEN * new program execution OPEN '','TRANSFILE' TO MYFILE ELSE MYTIME = @TIME END (Just as I am about to send this, I see a similar suggestion from Mark Eastwood.) Rick Nuckolls Lynden Inc ___ 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] Stumped with TRANS...
It's already a subroutine...not being used by an I-desc > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Jeff Schasny > Sent: Monday, October 11, 2010 4:42 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > I would suggest that in a case where you want to determine which one of > the apparently multiple possible states the remote record occupies you > should consider calling a subroutine from an I descriptor which returns > a status code of some sort. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
I would suggest that in a case where you want to determine which one of the apparently multiple possible states the remote record occupies you should consider calling a subroutine from an I descriptor which returns a status code of some sort. George Gallen wrote: If you a 'C' instead of using 'X' TRANS returns the @ID if the read was unsuccessful, my only problem with this was that on occaision my data was the same as the @ID, so I couldn't differential between the bad read response from TRANS and a good read with data = @ID I suppose, I could read the whole record, and only if data = @ID do a second read wouldn't be too expensive, since it's quite a minority of the time that would happen. But either way, 'X' or 'C', unless I actually do an OPEN/READ it will require a double TRANS to clarify. George -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- boun...@listserver.u2ug.org] On Behalf Of Rick Nuckolls Sent: Monday, October 11, 2010 4:06 PM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... I do not think that there is a way to test the result of a TRANS to discover if the read succeeded or was not found. So, that would leave the slightly flawed options of a) calling a subroutine or b) using the itype below (though it does have a problem with a record id of "", or a value in F1 of 'not found'). What did you want to happen if the record is not on file? I doubt that you would, in practice, find much penalty for doing the TRANS twice on the same record. Example for a dictionary: TRANS(transfile, @ID,@ID,'X'); IF @ = '' THEN 'not found' ELSE TRANS( transfile, @ID, F1,'X') For Basic: VALUE = TRANS("TRANSFILE", id, 1, "X") IF VALUE = "" THEN IF TRANS("TRANSFILE", id, 0, "X") = "" THEN VALUE = "not found" END END But ultimately, either one is flawed if the key is blank. Is there some reason why you do not want to open the file to named common? COMMON /MYSUB/ MYTIME, MYFILE IF (MYTIME # @TIME ) THEN * new program execution OPEN '','TRANSFILE' TO MYFILE ELSE MYTIME = @TIME END (Just as I am about to send this, I see a similar suggestion from Mark Eastwood.) Rick Nuckolls Lynden Inc ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
If you a 'C' instead of using 'X' TRANS returns the @ID if the read was unsuccessful, my only problem with this was that on occaision my data was the same as the @ID, so I couldn't differential between the bad read response from TRANS and a good read with data = @ID I suppose, I could read the whole record, and only if data = @ID do a second read wouldn't be too expensive, since it's quite a minority of the time that would happen. But either way, 'X' or 'C', unless I actually do an OPEN/READ it will require a double TRANS to clarify. George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Rick Nuckolls > Sent: Monday, October 11, 2010 4:06 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > I do not think that there is a way to test the result of a TRANS to > discover if the read succeeded or was not found. So, that would leave > the slightly flawed options of a) calling a subroutine or b) using the > itype below (though it does have a problem with a record id of "", or a > value in F1 of 'not found'). What did you want to happen if the record > is not on file? > > I doubt that you would, in practice, find much penalty for doing the > TRANS twice on the same record. > > Example for a dictionary: > > TRANS(transfile, @ID,@ID,'X'); IF @ = '' THEN 'not found' ELSE TRANS( > transfile, @ID, F1,'X') > > For Basic: > > VALUE = TRANS("TRANSFILE", id, 1, "X") > IF VALUE = "" THEN > IF TRANS("TRANSFILE", id, 0, "X") = "" THEN > VALUE = "not found" > END > END > > But ultimately, either one is flawed if the key is blank. > Is there some reason why you do not want to open the file to named > common? > > COMMON /MYSUB/ MYTIME, MYFILE > IF (MYTIME # @TIME ) THEN > * new program execution > OPEN '','TRANSFILE' TO MYFILE ELSE > MYTIME = @TIME > END > > (Just as I am about to send this, I see a similar suggestion from Mark > Eastwood.) > > Rick Nuckolls > Lynden Inc > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
I'll have to test that idea. Not an issue now, I reworked the program to pass in the FCB of the two files I needed to know, so there is no open expense. But still, I never used TRANS to read attribute 0 before George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Mark Eastwood > Sent: Monday, October 11, 2010 4:00 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > I have not been following this thread, so I might be off base... > But if your trying to determine if a record exists in another file > using > TRANS, you can Trans to Attribute 0 (the ID) if returns Null then you > know it does not. Assuming you really don't have Null ID's in the > target > file. > > Mark > > > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
I do not think that there is a way to test the result of a TRANS to discover if the read succeeded or was not found. So, that would leave the slightly flawed options of a) calling a subroutine or b) using the itype below (though it does have a problem with a record id of "", or a value in F1 of 'not found'). What did you want to happen if the record is not on file? I doubt that you would, in practice, find much penalty for doing the TRANS twice on the same record. Example for a dictionary: TRANS(transfile, @ID,@ID,'X'); IF @ = '' THEN 'not found' ELSE TRANS( transfile, @ID, F1,'X') For Basic: VALUE = TRANS("TRANSFILE", id, 1, "X") IF VALUE = "" THEN IF TRANS("TRANSFILE", id, 0, "X") = "" THEN VALUE = "not found" END END But ultimately, either one is flawed if the key is blank. Is there some reason why you do not want to open the file to named common? COMMON /MYSUB/ MYTIME, MYFILE IF (MYTIME # @TIME ) THEN * new program execution OPEN '','TRANSFILE' TO MYFILE ELSE MYTIME = @TIME END (Just as I am about to send this, I see a similar suggestion from Mark Eastwood.) Rick Nuckolls Lynden Inc On Oct 11, 2010, at 11:41 AM, George Gallen wrote: > yes, there are times, when the entire record is empty. The ID exists meaning > it's valid, but there has been no data associated with it yet. > > It was acceptable that > > 1. the record could be empty (but the @ID exist) > essentially, this is the same as <1> being "" > 2. the record could contain <1> and not be the same as @ID > 3. the record could contain <1> and be the same as @ID > 4. the record not exist (then a whole other set of checks come into play) > > It's just coincedence the <1> and @ID would be the same value, however > they are not the same field, so it's not that I'm duplicating the @ID > into <1>. > >> -Original Message- >> From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- >> boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin >> Sent: Monday, October 11, 2010 1:58 PM >> To: u2-users@listserver.u2ug.org >> Subject: Re: [U2] Stumped with TRANS... >> >> >> I don't mean to belabor this point, but unless your *entire* record is >> empty, doing the the trans with a full record requrest - >> TRANS('FNAME',@ID ,-1,'X') - you should only have a null returned if >> the record does not exist. I use Unidata; is Universe any different? >> You can do something like a DCOUNT to ensure that if <1> is emplty, >> there are other attributes in the record >> >> Last post, I promise. >> >> Cheers, >> >> Kebbon >> > ___ > 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] Stumped with TRANS...
I have not been following this thread, so I might be off base... But if your trying to determine if a record exists in another file using TRANS, you can Trans to Attribute 0 (the ID) if returns Null then you know it does not. Assuming you really don't have Null ID's in the target file. Mark -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Monday, October 11, 2010 11:42 AM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... yes, there are times, when the entire record is empty. The ID exists meaning it's valid, but there has been no data associated with it yet. It was acceptable that 1. the record could be empty (but the @ID exist) essentially, this is the same as <1> being "" 2. the record could contain <1> and not be the same as @ID 3. the record could contain <1> and be the same as @ID 4. the record not exist (then a whole other set of checks come into play) It's just coincedence the <1> and @ID would be the same value, however they are not the same field, so it's not that I'm duplicating the @ID into <1>. > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > Sent: Monday, October 11, 2010 1:58 PM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > I don't mean to belabor this point, but unless your *entire* record is > empty, doing the the trans with a full record requrest - > TRANS('FNAME',@ID ,-1,'X') - you should only have a null returned if > the record does not exist. I use Unidata; is Universe any different? > You can do something like a DCOUNT to ensure that if <1> is emplty, > there are other attributes in the record > > Last post, I promise. > > Cheers, > > Kebbon > ___ 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] Stumped with TRANS...
yes, there are times, when the entire record is empty. The ID exists meaning it's valid, but there has been no data associated with it yet. It was acceptable that 1. the record could be empty (but the @ID exist) essentially, this is the same as <1> being "" 2. the record could contain <1> and not be the same as @ID 3. the record could contain <1> and be the same as @ID 4. the record not exist (then a whole other set of checks come into play) It's just coincedence the <1> and @ID would be the same value, however they are not the same field, so it's not that I'm duplicating the @ID into <1>. > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > Sent: Monday, October 11, 2010 1:58 PM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > I don't mean to belabor this point, but unless your *entire* record is > empty, doing the the trans with a full record requrest - > TRANS('FNAME',@ID ,-1,'X') - you should only have a null returned if > the record does not exist. I use Unidata; is Universe any different? > You can do something like a DCOUNT to ensure that if <1> is emplty, > there are other attributes in the record > > Last post, I promise. > > Cheers, > > Kebbon > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
I don't mean to belabor this point, but unless your *entire* record is empty, doing the the trans with a full record requrest - TRANS('FNAME',@ID ,-1,'X') - you should only have a null returned if the record does not exist. I use Unidata; is Universe any different? You can do something like a DCOUNT to ensure that if <1> is emplty, there are other attributes in the record Last post, I promise. Cheers, Kebbon > From: ggal...@wyanokegroup.com > To: u2-users@listserver.u2ug.org > Date: Mon, 11 Oct 2010 08:56:49 -0500 > Subject: Re: [U2] Stumped with TRANS... > > no. I needed to know when the "" returned data was because the record didn't > exist or because it was an empty string, which is what the 'C' option give > you, which isn't a problem, unless by chance your returned data just happed > to be the same as the @ID (Which in our case was about a 1:100 chance). > > George > > > -Original Message- > > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > > Sent: Friday, October 08, 2010 6:25 PM > > To: u2-users@listserver.u2ug.org > > Subject: Re: [U2] Stumped with TRANS... > > > > > > Would using the 'X' option in conjunction with the -1 field not do what > > you want. No record so @1 is null, else read successful. Unless, of > > course you have empty records with just @ID > > > > > From: ggal...@wyanokegroup.com > > > To: u2-users@listserver.u2ug.org > > > Date: Fri, 8 Oct 2010 10:34:07 -0500 > > > Subject: Re: [U2] Stumped with TRANS... > > > > > > When you use the 'C' parameter, Trans will return the record ID if > > the record does not exist, > > > and the full record if it does exist (in my case it did, since I used > > -1 as the field). > > > > > > Problem is that occaisionally, the full record was only 1 attribute, > > and that attribute > > > just happened to have the value that was the same as the @ID, making > > it impossible to > > > tell the difference between a valid attribute data vs the TRANS's > > "error" reporting method. > > > > > > George > > > > > > > -Original Message- > > > > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > > > > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > > > > Sent: Friday, October 08, 2010 11:31 AM > > > > To: u2-users@listserver.u2ug.org > > > > Subject: Re: [U2] Stumped with TRANS... > > > > > > > > > > > > Why not read the whole record in with the TRANS and then check <1> > > > > using EXTRACT? > > > > > > > ___ > > > 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 ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
no. I needed to know when the "" returned data was because the record didn't exist or because it was an empty string, which is what the 'C' option give you, which isn't a problem, unless by chance your returned data just happed to be the same as the @ID (Which in our case was about a 1:100 chance). George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > Sent: Friday, October 08, 2010 6:25 PM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > Would using the 'X' option in conjunction with the -1 field not do what > you want. No record so @1 is null, else read successful. Unless, of > course you have empty records with just @ID > > > From: ggal...@wyanokegroup.com > > To: u2-users@listserver.u2ug.org > > Date: Fri, 8 Oct 2010 10:34:07 -0500 > > Subject: Re: [U2] Stumped with TRANS... > > > > When you use the 'C' parameter, Trans will return the record ID if > the record does not exist, > > and the full record if it does exist (in my case it did, since I used > -1 as the field). > > > > Problem is that occaisionally, the full record was only 1 attribute, > and that attribute > > just happened to have the value that was the same as the @ID, making > it impossible to > > tell the difference between a valid attribute data vs the TRANS's > "error" reporting method. > > > > George > > > > > -Original Message- > > > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > > > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > > > Sent: Friday, October 08, 2010 11:31 AM > > > To: u2-users@listserver.u2ug.org > > > Subject: Re: [U2] Stumped with TRANS... > > > > > > > > > Why not read the whole record in with the TRANS and then check <1> > > > using EXTRACT? > > > > > ___ > > 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] Stumped with TRANS...
Would using the 'X' option in conjunction with the -1 field not do what you want. No record so @1 is null, else read successful. Unless, of course you have empty records with just @ID > From: ggal...@wyanokegroup.com > To: u2-users@listserver.u2ug.org > Date: Fri, 8 Oct 2010 10:34:07 -0500 > Subject: Re: [U2] Stumped with TRANS... > > When you use the 'C' parameter, Trans will return the record ID if the record > does not exist, > and the full record if it does exist (in my case it did, since I used -1 as > the field). > > Problem is that occaisionally, the full record was only 1 attribute, and that > attribute > just happened to have the value that was the same as the @ID, making it > impossible to > tell the difference between a valid attribute data vs the TRANS's "error" > reporting method. > > George > > > -Original Message- > > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > > Sent: Friday, October 08, 2010 11:31 AM > > To: u2-users@listserver.u2ug.org > > Subject: Re: [U2] Stumped with TRANS... > > > > > > Why not read the whole record in with the TRANS and then check <1> > > using EXTRACT? > > > ___ > 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] Stumped with TRANS...
Since you're already in a subroutine and an OPEN/READV has to happen each time a TRANS is used, do a real OPEN/READV which will give you the END ELSE option. This will cut down on the additional testing you need to do so your net processing time should be slightly lower. Just because you HAVE a function available doesn't mean you have to USE that function. Unless you have other motivations for using TRANS, that is. Good luck! -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Friday, October 08, 2010 8:34 AM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... When you use the 'C' parameter, Trans will return the record ID if the record does not exist, and the full record if it does exist (in my case it did, since I used -1 as the field). Problem is that occaisionally, the full record was only 1 attribute, and that attribute just happened to have the value that was the same as the @ID, making it impossible to tell the difference between a valid attribute data vs the TRANS's "error" reporting method. George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > Sent: Friday, October 08, 2010 11:31 AM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > Why not read the whole record in with the TRANS and then check <1> > using EXTRACT? > ___ 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] Stumped with TRANS...
When you use the 'C' parameter, Trans will return the record ID if the record does not exist, and the full record if it does exist (in my case it did, since I used -1 as the field). Problem is that occaisionally, the full record was only 1 attribute, and that attribute just happened to have the value that was the same as the @ID, making it impossible to tell the difference between a valid attribute data vs the TRANS's "error" reporting method. George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kebbon Irwin > Sent: Friday, October 08, 2010 11:31 AM > To: u2-users@listserver.u2ug.org > Subject: Re: [U2] Stumped with TRANS... > > > Why not read the whole record in with the TRANS and then check <1> > using EXTRACT? > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
Why not read the whole record in with the TRANS and then check <1> using EXTRACT? > From: ggal...@wyanokegroup.com > To: u2-users@listserver.u2ug.org > Date: Thu, 7 Oct 2010 16:20:17 -0500 > Subject: [U2] Stumped with TRANS... > > ok. I'm using TRANS to read some data, but I need to be able to tell if the > record exists, WITHOUT producing an error message. > > ok. So, I use the 'C' command, where it's supposed to return the @ID if it > doesn't exist > BUTI have records where the only data in <1> is the record ID (by > coincedence). > > so I'd get: > > 1 @ID if the record does not exist > 2 non zero lenth data that happens to be same as @ID (some of the records and > OK) > 3 zero length data if the @ID exists, but has no data (which is OK) > 4 non zero length data that is not the same as the @ID (which is OK) > > How can I distinguish between cases 1 and 2 ? > > I can't think of any way..and continue using TRANS. I really don't want > to create a VOC entry for the file > then open this temporary file, then read the record. But I might have to. > > > George Gallen > Senior Programmer/Analyst > Accounting/Data Division, EDI Administrator > ggal...@wyanokegroup.com > ph:856.848.9005 Ext 220 > The Wyanoke Group > http://www.wyanokegroup.com > > > > ___ > 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] Stumped with TRANS...
Has anyone done a timing test to compare a SUBR which uses a common section to store an opened file variable vs a TRANS ? ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
It's already a subroutine. It's the tests that are the problem. If I used an OPEN and a READ I wouldn't have an issue. It's trying to get TRANS to be all it can be that is the problem. I might also consider passing the one file's FCB into the subroutine to avoid an OPEN, but I wanted to make this subroutine something that could be called from multiple programs that may or may not have that file open... But since a TRANS is about as intensive as an OPEN/READ it probably wouldn't be any difference is processing time. George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Israel, John R. > Sent: Friday, October 08, 2010 9:15 AM > To: 'U2 Users List' > Subject: Re: [U2] Stumped with TRANS... > > Instead of a TRANS with various conditions, call a subroutine that has > all the tests you need. > > > John Israel > Senior Programmer/Analyst > Dayton Superior Corporation > 1125 Byers Road > Miamisburg, OH 45342 > > > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of George Gallen > Sent: Friday, October 08, 2010 9:14 AM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > hmmm. might work. I'll have to try it just to see, but I'll > most likely go with switching field orders, since I'd rather > not do a double TRANS, in case the file I'm scanning gets > a lot bigger, then processing time will be significant. > > Thanks > > George > > > -Original Message- > > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > > boun...@listserver.u2ug.org] On Behalf Of Bob Woodward > > Sent: Thursday, October 07, 2010 7:22 PM > > To: U2 Users List > > Subject: Re: [U2] Stumped with TRANS... > > > > Can you chain two TRANS functions and compare the results? If you > use > > "C" the first time and "X" the second time then you would be able to > > know if there is no record when the two results are different. If > the > > record doesn't exist, you would only have @ID in the first result but > > the second result would be blank. If the record does exist and the > > field you are getting is the key value, then the first AND second > > results would be equal, both containing @ID. > > > > BobW > > > ___ > 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] Stumped with TRANS...
This would be from basic, but the idea is same. Problem is there could be a (@record="") record (just an @ID), I needed a way to differentiate between @record="" and Does not exist, which was why I used 'C', but this is complicated by there could be records that had only <1> that happened to be the same as the @ID, wherein lies the problem. The double TRANS Bob mentioned should work, but is slower. George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Kate Stanton > Sent: Thursday, October 07, 2010 8:31 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > How about: > > TRANS(filename,recID,@RECORD,'x'); IF @ = "" THEN 'not there' ELSE > @<1,fieldno> > > On Fri, Oct 8, 2010 at 12:21 PM, Bob Woodward > wrote: > > > Can you chain two TRANS functions and compare the results? If you > use > > "C" the first time and "X" the second time then you would be able to > > know if there is no record when the two results are different. If > the > > record doesn't exist, you would only have @ID in the first result but > > the second result would be blank. If the record does exist and the > > field you are getting is the key value, then the first AND second > > results would be equal, both containing @ID. > > > > BobW > > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
Instead of a TRANS with various conditions, call a subroutine that has all the tests you need. John Israel Senior Programmer/Analyst Dayton Superior Corporation 1125 Byers Road Miamisburg, OH 45342 -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Friday, October 08, 2010 9:14 AM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... hmmm. might work. I'll have to try it just to see, but I'll most likely go with switching field orders, since I'd rather not do a double TRANS, in case the file I'm scanning gets a lot bigger, then processing time will be significant. Thanks George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Bob Woodward > Sent: Thursday, October 07, 2010 7:22 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > Can you chain two TRANS functions and compare the results? If you use > "C" the first time and "X" the second time then you would be able to > know if there is no record when the two results are different. If the > record doesn't exist, you would only have @ID in the first result but > the second result would be blank. If the record does exist and the > field you are getting is the key value, then the first AND second > results would be equal, both containing @ID. > > BobW > ___ 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] Stumped with TRANS...
hmmm. might work. I'll have to try it just to see, but I'll most likely go with switching field orders, since I'd rather not do a double TRANS, in case the file I'm scanning gets a lot bigger, then processing time will be significant. Thanks George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Bob Woodward > Sent: Thursday, October 07, 2010 7:22 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > Can you chain two TRANS functions and compare the results? If you use > "C" the first time and "X" the second time then you would be able to > know if there is no record when the two results are different. If the > record doesn't exist, you would only have @ID in the first result but > the second result would be blank. If the record does exist and the > field you are getting is the key value, then the first AND second > results would be equal, both containing @ID. > > BobW > ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Stumped with TRANS...
That's the main problem. I don't always know if it exists. ButI think I found a solution during last night's slumber I'm going to switch field 1 and field 2, this way if field 2 ever is going to be the same as @ID, it will now be preceeded by an AM, making the @RECORD # @ID Thanks George > -Original Message- > From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users- > boun...@listserver.u2ug.org] On Behalf Of Oaks, Harold > Sent: Thursday, October 07, 2010 6:01 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > George: > > Here's something that might work for you, PROVIDED that you always know > that if the target record exists, there is always something in field 1. > It seems like this is the situation for you - there is always something > in that field if the record exists at all. > > In the DICT of your main file enter this I-type record. Let's call it > CHK.EXIST: > <1> I > <2> TRANS(OTHERFILE_NAME,OTHERFILE_KEY,FIELD_1_NAME,'X') > <3> > <4> > <5> 20L(or whatever) > <6> S > > With the 'X' parameter, if the otherfile record does not exist, then > nothing (i.e. a zero-length string) is returned, otherwise the content > of field 1 is returned. This way you know if the target record exists. > > Now you have a second DICT entry, GET.FIELD: > <1> I > <2> IF CHK.EXIST THEN > TRANS(OTHERFILE_NAME,OTHERFILE_KEY,WANTED_FIELD,'X') ELSE 'NO RECORD' > <3> > <4> > <5> 20L > <6> S > > If the otherfile record does not exist, GETFIELD returns the phrase 'NO > RECORD', otherwise it will return the contents of the field you're > actually interested in, which may be empty. > > Harold Oaks > Clark County, WA > > > -Original Message- > From: u2-users-boun...@listserver.u2ug.org > [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George > Gallen > Sent: Thursday, October 07, 2010 2:20 PM > To: U2 Users List > Subject: [U2] Stumped with TRANS... > > ok. I'm using TRANS to read some data, but I need to be able to tell if > the record exists, WITHOUT producing an error message. > > ok. So, I use the 'C' command, where it's supposed to return the @ID if > it doesn't exist > BUTI have records where the only data in <1> is the record ID (by > coincedence). > > so I'd get: > > 1 @ID if the record does not exist > 2 non zero lenth data that happens to be same as @ID (some of the > records and OK) > 3 zero length data if the @ID exists, but has no data (which is OK) > 4 non zero length data that is not the same as the @ID (which is OK) > > How can I distinguish between cases 1 and 2 ? > > I can't think of any way..and continue using TRANS. I really don't > want to create a VOC entry for the file > then open this temporary file, then read the record. But I might > have to. > > > George Gallen > Senior Programmer/Analyst > Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com > ph:856.848.9005 Ext 220 > The Wyanoke Group > http://www.wyanokegroup.com > > > > ___ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > > > This e-mail and related attachments and any response may be subject to > public disclosure under state law. > ___ > 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] Stumped with TRANS...
How about: TRANS(filename,recID,@RECORD,'x'); IF @ = "" THEN 'not there' ELSE @<1,fieldno> On Fri, Oct 8, 2010 at 12:21 PM, Bob Woodward wrote: > Can you chain two TRANS functions and compare the results? If you use > "C" the first time and "X" the second time then you would be able to > know if there is no record when the two results are different. If the > record doesn't exist, you would only have @ID in the first result but > the second result would be blank. If the record does exist and the > field you are getting is the key value, then the first AND second > results would be equal, both containing @ID. > > BobW > > -Original Message- > From: u2-users-boun...@listserver.u2ug.org > [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Oaks, Harold > Sent: Thursday, October 07, 2010 3:01 PM > To: U2 Users List > Subject: Re: [U2] Stumped with TRANS... > > George: > > Here's something that might work for you, PROVIDED that you always know > that if the target record exists, there is always something in field 1. > It seems like this is the situation for you - there is always something > in that field if the record exists at all. > > In the DICT of your main file enter this I-type record. Let's call it > CHK.EXIST: > <1> I > <2> TRANS(OTHERFILE_NAME,OTHERFILE_KEY,FIELD_1_NAME,'X') > <3> > <4> > <5> 20L(or whatever) > <6> S > > With the 'X' parameter, if the otherfile record does not exist, then > nothing (i.e. a zero-length string) is returned, otherwise the content > of field 1 is returned. This way you know if the target record exists. > > Now you have a second DICT entry, GET.FIELD: > <1> I > <2> IF CHK.EXIST THEN > TRANS(OTHERFILE_NAME,OTHERFILE_KEY,WANTED_FIELD,'X') ELSE 'NO RECORD' > <3> > <4> > <5> 20L > <6> S > > If the otherfile record does not exist, GETFIELD returns the phrase 'NO > RECORD', otherwise it will return the contents of the field you're > actually interested in, which may be empty. > > Harold Oaks > Clark County, WA > > > -Original Message- > From: u2-users-boun...@listserver.u2ug.org > [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen > Sent: Thursday, October 07, 2010 2:20 PM > To: U2 Users List > Subject: [U2] Stumped with TRANS... > > ok. I'm using TRANS to read some data, but I need to be able to tell if > the record exists, WITHOUT producing an error message. > > ok. So, I use the 'C' command, where it's supposed to return the @ID if > it doesn't exist > BUTI have records where the only data in <1> is the record ID (by > coincedence). > > so I'd get: > > 1 @ID if the record does not exist > 2 non zero lenth data that happens to be same as @ID (some of the > records and OK) > 3 zero length data if the @ID exists, but has no data (which is OK) > 4 non zero length data that is not the same as the @ID (which is OK) > > How can I distinguish between cases 1 and 2 ? > > I can't think of any way..and continue using TRANS. I really don't > want to create a VOC entry for the file >then open this temporary file, then read the record. But I might > have to. > > > George Gallen > Senior Programmer/Analyst > Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com > ph:856.848.9005 Ext 220 > The Wyanoke Group > http://www.wyanokegroup.com > > > > ___ > U2-Users mailing list > U2-Users@listserver.u2ug.org > http://listserver.u2ug.org/mailman/listinfo/u2-users > > > This e-mail and related attachments and any response may be subject to > public disclosure under state law. > ___ > 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] Stumped with TRANS...
Can you chain two TRANS functions and compare the results? If you use "C" the first time and "X" the second time then you would be able to know if there is no record when the two results are different. If the record doesn't exist, you would only have @ID in the first result but the second result would be blank. If the record does exist and the field you are getting is the key value, then the first AND second results would be equal, both containing @ID. BobW -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Oaks, Harold Sent: Thursday, October 07, 2010 3:01 PM To: U2 Users List Subject: Re: [U2] Stumped with TRANS... George: Here's something that might work for you, PROVIDED that you always know that if the target record exists, there is always something in field 1. It seems like this is the situation for you - there is always something in that field if the record exists at all. In the DICT of your main file enter this I-type record. Let's call it CHK.EXIST: <1> I <2> TRANS(OTHERFILE_NAME,OTHERFILE_KEY,FIELD_1_NAME,'X') <3> <4> <5> 20L(or whatever) <6> S With the 'X' parameter, if the otherfile record does not exist, then nothing (i.e. a zero-length string) is returned, otherwise the content of field 1 is returned. This way you know if the target record exists. Now you have a second DICT entry, GET.FIELD: <1> I <2> IF CHK.EXIST THEN TRANS(OTHERFILE_NAME,OTHERFILE_KEY,WANTED_FIELD,'X') ELSE 'NO RECORD' <3> <4> <5> 20L <6> S If the otherfile record does not exist, GETFIELD returns the phrase 'NO RECORD', otherwise it will return the contents of the field you're actually interested in, which may be empty. Harold Oaks Clark County, WA -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Thursday, October 07, 2010 2:20 PM To: U2 Users List Subject: [U2] Stumped with TRANS... ok. I'm using TRANS to read some data, but I need to be able to tell if the record exists, WITHOUT producing an error message. ok. So, I use the 'C' command, where it's supposed to return the @ID if it doesn't exist BUTI have records where the only data in <1> is the record ID (by coincedence). so I'd get: 1 @ID if the record does not exist 2 non zero lenth data that happens to be same as @ID (some of the records and OK) 3 zero length data if the @ID exists, but has no data (which is OK) 4 non zero length data that is not the same as the @ID (which is OK) How can I distinguish between cases 1 and 2 ? I can't think of any way..and continue using TRANS. I really don't want to create a VOC entry for the file then open this temporary file, then read the record. But I might have to. George Gallen Senior Programmer/Analyst Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com ph:856.848.9005 Ext 220 The Wyanoke Group http://www.wyanokegroup.com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users This e-mail and related attachments and any response may be subject to public disclosure under state law. ___ 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] Stumped with TRANS...
George: Here's something that might work for you, PROVIDED that you always know that if the target record exists, there is always something in field 1. It seems like this is the situation for you - there is always something in that field if the record exists at all. In the DICT of your main file enter this I-type record. Let's call it CHK.EXIST: <1> I <2> TRANS(OTHERFILE_NAME,OTHERFILE_KEY,FIELD_1_NAME,'X') <3> <4> <5> 20L(or whatever) <6> S With the 'X' parameter, if the otherfile record does not exist, then nothing (i.e. a zero-length string) is returned, otherwise the content of field 1 is returned. This way you know if the target record exists. Now you have a second DICT entry, GET.FIELD: <1> I <2> IF CHK.EXIST THEN TRANS(OTHERFILE_NAME,OTHERFILE_KEY,WANTED_FIELD,'X') ELSE 'NO RECORD' <3> <4> <5> 20L <6> S If the otherfile record does not exist, GETFIELD returns the phrase 'NO RECORD', otherwise it will return the contents of the field you're actually interested in, which may be empty. Harold Oaks Clark County, WA -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen Sent: Thursday, October 07, 2010 2:20 PM To: U2 Users List Subject: [U2] Stumped with TRANS... ok. I'm using TRANS to read some data, but I need to be able to tell if the record exists, WITHOUT producing an error message. ok. So, I use the 'C' command, where it's supposed to return the @ID if it doesn't exist BUTI have records where the only data in <1> is the record ID (by coincedence). so I'd get: 1 @ID if the record does not exist 2 non zero lenth data that happens to be same as @ID (some of the records and OK) 3 zero length data if the @ID exists, but has no data (which is OK) 4 non zero length data that is not the same as the @ID (which is OK) How can I distinguish between cases 1 and 2 ? I can't think of any way..and continue using TRANS. I really don't want to create a VOC entry for the file then open this temporary file, then read the record. But I might have to. George Gallen Senior Programmer/Analyst Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com ph:856.848.9005 Ext 220 The Wyanoke Group http://www.wyanokegroup.com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users This e-mail and related attachments and any response may be subject to public disclosure under state law. ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
[U2] Stumped with TRANS...
ok. I'm using TRANS to read some data, but I need to be able to tell if the record exists, WITHOUT producing an error message. ok. So, I use the 'C' command, where it's supposed to return the @ID if it doesn't exist BUTI have records where the only data in <1> is the record ID (by coincedence). so I'd get: 1 @ID if the record does not exist 2 non zero lenth data that happens to be same as @ID (some of the records and OK) 3 zero length data if the @ID exists, but has no data (which is OK) 4 non zero length data that is not the same as the @ID (which is OK) How can I distinguish between cases 1 and 2 ? I can't think of any way..and continue using TRANS. I really don't want to create a VOC entry for the file then open this temporary file, then read the record. But I might have to. George Gallen Senior Programmer/Analyst Accounting/Data Division, EDI Administrator ggal...@wyanokegroup.com ph:856.848.9005 Ext 220 The Wyanoke Group http://www.wyanokegroup.com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users