Page 1 of 1

Insert return_rrn not working

Posted: Sat Oct 13, 2018 1:14 am
by eddie9394
I use a insert with return_rrn() hopping to get the RRN of the inserted record, however i am getting the RRN of the first record with the same key. I had changed the SQL_table to allow duplicate keys and removed all the indexes, it is still not working right. Any idea? THANKS!

Code: Select all


selectlist named(#WRKLIST)

insert fields(#FileFields) to_file(CF) return_rrn(#wk_Number)

#wk_String1 := ("RRN:[&1]&2").Substitute( #wk_Number.AsString, #Location )
#SYS_APPLN.TraceMessageText( #wk_String1 )

endselect

Result :
2018-10-12 09:04:06.773 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.784 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.792 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.8 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.808 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.817 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.825 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.834 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.843 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.851 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.858 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.866 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.873 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.88 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.887 RSVUDAS01 159 RRN:[1]Seattle WA USA
2018-10-12 09:04:06.894 RSVUDAS01 159 RRN:[16]Meriden CT USA
2018-10-12 09:04:06.903 RSVUDAS01 159 RRN:[16]Meriden CT USA
2018-10-12 09:04:06.912 RSVUDAS01 159 RRN:[16]Meriden CT USA
2018-10-12 09:04:06.92 RSVUDAS01 159 RRN:[19]Anderson-Muncie IN USA
2018-10-12 09:04:06.929 RSVUDAS01 159 RRN:[16]Meriden CT USA
2018-10-12 09:04:06.937 RSVUDAS01 159 RRN:[16]Meriden CT USA
2018-10-12 09:04:06.945 RSVUDAS01 159 RRN:[22]Boise ID USA

Re: Insert return_rrn not working

Posted: Sat Oct 13, 2018 1:26 am
by lawingo
Are the records actually inserting into the table? - Meaning could it be trying to insert and the insert fails and returns a bogus record?

Also - what is the definition of "WK_Number"? I typically use "PRIFILRRN" as the return field for the RRN. It's Decimal(15,0).

Re: Insert return_rrn not working

Posted: Wed Oct 17, 2018 1:00 am
by eddie9394
yes, records are actually inserted in the table and the field is 15,0. I changed my logic to work around it. However, the Insert with RRN statement should work but it is not! :cry:

I have to use select_SQL using (Select RRN(<File>) from <File> ) to get the RRN