[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Extraneous Rows Inserted in SQR



I assumed that you are inserting new rows in PS_JOB. Since JOB is
a table with multiple keys, I would make my select statements
according to the placement of the keys such as 1. Emplid 2. Empl_RCD#
3. Effdt and 4. Effseq. In your select statement you did not include
the EMPL_RCD# as the first order of select since I also assumed you
are reading JOB as ordered by EMPLID.

What I would do is create a procedure to read JOB (just like your
select statements) except I will order it by Emplid, Empl_Rcd# desc,
Effdt desc, Effseq desc. This way I will always have the latest rows
as the first record being read. To avoid reading the subsequent rows,
I will have to control the reading of rows within the same EMPLID:

Eample:

Begin-Procedure Read-Job
let $OldEmplid = '         '
let #test = 0
begin-select

[Your field selection here]

TEST:

    If #test = 0

      move 1 to # test
      move &EMPLID to $OldEmplid

      [Do you regular processing here like adding rows]

    else

      if &emplid = $OldEmplid
         goto BYPASS
       else

         Move 0 to #test
         goto TEST
       end-if
     end-if

BYPASS:

>From  [Your tables here]

where  ????
Order by emplid, empl_rcd# desc, effdt desc, effseq desc.

end-select
end-procedure








_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp