Insert return_rrn not working

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
eddie9394
Posts: 23
Joined: Tue Aug 14, 2018 11:03 pm

Insert return_rrn not working

Post 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
User avatar
lawingo
Posts: 78
Joined: Fri Dec 04, 2015 6:41 am

Re: Insert return_rrn not working

Post 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).
eddie9394
Posts: 23
Joined: Tue Aug 14, 2018 11:03 pm

Re: Insert return_rrn not working

Post 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
Post Reply