Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2015
    Posts
    3

    Unanswered: Using "Upsert" in rpgle

    I am trying to use the "upsert" for the first time. I was wondering if you can reference a record format via external data structure rather than listing all the fields. Here is my scenario: I want to update/insert into a file called CSEML. I have an external data structure which references the file. It is called CSEMLR. The enclosed Merge statement produces SQLSTT = '42704'. Can someone suggest corrections? Thank you.

    d csemlr e ds extname(cseml) inz qualified

    exec sql merge into cseml tgt
    using csemlr
    as src (csemlr)
    on tgt.cecono = 40 and tgt.ceemgp = 'COM' and
    tgt.cecsno = :imgaft.cmcsno
    when matched then update set
    tgt.ceemad = :w1ced1
    when not matched then
    insert values(csemlr);

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    42704 is related to lbac
    show the complete command/return code-message
    db2 version ? platform ? application used ?
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •