PDA

View Full Version : Relative Records Number



B.Morris
01-07-2003, 08:40 AM
JR wrote: > > Hey All. I am trying to write the actual Relative Record Number to a file for easier access in another application. The file is defined as Output - I write records to it and that's it. I put the INFDS and retrieved the RRN, it doesn't seem to work on the first record only, if I process multiple records (say 5) records 2,3,4 and 5 have the correct record number. Record 1 has a really strange number (it's always the same for the first record) - I think I know the reason why but I don't know how to get around it. Can anybody help??? Thanks in advance. JR, The RRN field of the INFDS isn't updated until after the record is written. If you have blocking, it won't be updated until the block is complete, and then it will show the last record written. It doesn't sound like you have the blocking problem, since records 2-5 are ok, but the "strange number" (is it 1077952576 = x'40404040'?) does sound like you're trying to read the RRN from the INFDS before it has been set. I'm a bit confused, though. Are you writing records to one file and then writing the RRN of those records to another file? If so, then I can't guess why you would be having a problem. Or are you writing the RRN of a record to the record itself? If so, then that would explain why the written rrn of the first record is wrong, but I would have thought that each record would get the rrn of the previous record: record 2 would get rrn=1 etc.

jrhoads@cdsgroup.com
01-07-2003, 08:49 AM
Barbara, Thanks for the response. That is exactly what the RRN is on the first record. I kind of figured that is what the problem was. I am trying to write the RRN to record itself. I think it is giving me RRN for #1 in record #2 and so on. The problem is, it's a PO History file and if I CALL another program to update the record with the correct RRN, I don't have a clean KEY to retrieve the correct record. The KEYS are PO#, received Date, SKU#, STORE, INVNO, and INVSEQ. The problem is that each record for a multiple QTY PO is pretty much the same other than the SERIAL#. So when I chain to the file, it updates the first record all of the time. The file doesn't have Sequence Number in it. I don't know how I need to work around this. Any suggestions??? Thanks again. JR

B.Morris
01-07-2003, 09:18 AM
JR wrote: > > Barbara, > Thanks for the response. That is exactly what the RRN is on the first record. I kind of figured that is what the problem was. I am trying to write the RRN to record itself. I think it is giving me RRN for #1 in record #2 and so on. The problem is, it's a PO History file and if I CALL another program to update the record with the correct RRN, I don't have a clean KEY to retrieve the correct record. The KEYS are PO#, received Date, SKU#, STORE, INVNO, and INVSEQ. The problem is that each record for a multiple QTY PO is pretty much the same other than the SERIAL#. So when I chain to the file, it updates the first record all of the time. The file doesn't have Sequence Number in it. I don't know how I need to work around this. Any suggestions??? Thanks again. JR, if you open the update file non-keyed, you should be able to chain to the file by the RRN.

jrhoads@cdsgroup.com
01-07-2003, 09:36 AM
Barbara, I just tried that before you replied and it worked. Thanks again for all your information. Take care. JR

Guest.Visitor
01-08-2003, 06:46 AM
JR, What are the implications of writing a relative record number on the record? Does the relative record number change if the physical file is reorganized? If a file has 100 records and records 2 through 99 are deleted and then you reorganized wouldn't record 100 now become record 2? Wouldn't that leave you with an "out of sync" condition? chuck Opinions expressed are not necessarily those of my employer. "JR" <Jrhoads@mcpressonline.com> wrote in message news:6ae5607f.-1@WebX.WawyahGHajS... | Hey All. I am trying to write the actual Relative Record Number to a file for easier access in another application. The file is defined as Output - I write records to it and that's it. I put the INFDS and retrieved the RRN, it doesn't seem to work on the first record only, if I process multiple records (say 5) records 2,3,4 and 5 have the correct record number. Record 1 has a really strange number (it's always the same for the first record) - I think I know the reason why but I don't know how to get around it. Can anybody help??? Thanks in advance. | | JR

GlenKerner
01-08-2003, 08:25 AM
I believe JR is right. If you reorganize the physical file the potential is there to have all new RRNs. Most P/O systems I know have one additional field at the detail level, Line number. Does your system have line number? Shouldn't the uniqueness be Vendor, P/O, Line Number?

jrhoads@cdsgroup.com
01-08-2003, 10:53 AM
Glen, Our system does have a Line Number but not in the PO History file. That is where the problem lies. Once the item is received on a PO, it writes to the PO History file. at that point, we really don't care what line it was on the PO, just that it has been received. For what we are doing, EDI PO Invoicing, I could use that Line Number to match up the A/P Invoice records with their correct PO Lines so I know what PO Line I received the A/P Invoice for. Our AP system, references the RRN in most of our programs. We don't Re-Organzie our file so in that aspect, I am safe. Right now, I wish I had the PO Line Number is History but the way I did it should work fine. Thanks for the input guys (and girls) JR

GlenKerner
01-09-2003, 06:56 AM
I hope you never have to restore the files. If I'm not mistaken deleted records are not restored and the file is in essence reorganized. Depending on the size of your system and how often records are deleted out of your files, I would suspect that without reorganizing files you will eventually start running into available disk space and either buy more drives or start reorganizing files. Good luck. PS. I would consider changing the PO History to be more accurate (include all information including line number) and not use RRN.

DougCMH
01-12-2003, 08:44 AM
Just for future reference (and this may or may not apply to this discussion): If you have an RRN field in a file, and you want to resynch it after a reorg, try this SQL: <pre> update YOURFILE set RRNFIELD = RRN(YOURFILE) </pre> This should also work in maintenance applications as well, either once at the end of the maintenance session, or by using a <tt>WHERE</tt> clause to select the record by a key.

jrhoads@cdsgroup.com
01-12-2003, 08:45 AM
Hey All. I am trying to write the actual Relative Record Number to a file for easier access in another application. The file is defined as Output - I write records to it and that's it. I put the INFDS and retrieved the RRN, it doesn't seem to work on the first record only, if I process multiple records (say 5) records 2,3,4 and 5 have the correct record number. Record 1 has a really strange number (it's always the same for the first record) - I think I know the reason why but I don't know how to get around it. Can anybody help??? Thanks in advance. JR