Rocket U2 | UniVerse & UniData

 View Only
  • 1.  Comparing records in different files

    Posted 06-26-2022 15:18
    I'm developing a subroutine that will copy a record from one file to another.
    Depending on the value of one of the input arguments, the target record will be overwritten if it already exists in the target file.
    Upon confirmation of a successful copy, and depending on the value of another input argument, the source record could potentially be deleted.

    I'm looking for methods of confirming the copy was successful; i.e., the target record is identical to the source record.

    Any suggestions?

    ------------------------------
    Shawn Waldie
    Manager, Enterprise Application Development
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------


  • 2.  RE: Comparing records in different files

    PARTNER
    Posted 06-27-2022 02:24
    hi Shawn, 

    Why reinvent the wheel ? use tcl COPY ! 
    COPYI if you run pick flavor. 

    COPYI FROM file {TO file}  (recordid{,newrecordid}} {} | ALL | activeselectlist )  {OVERWRITING} {DELETING} 

    About 'confirmation', with WRITE use ON ERROR then you trap any error. 

    regards
    manu

    ------------------------------
    Manu Fernandes
    ------------------------------



  • 3.  RE: Comparing records in different files

    Posted 06-27-2022 08:47
    Thank you, and yes, agreed.
    I'm actually using the COPY command in the subroutine.
    I have several conditional COPY actions to make, and I wanted to save some lines of code.

    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------



  • 4.  RE: Comparing records in different files

    ROCKETEER
    Posted 06-27-2022 08:07
    While (surprisingly) not widely used, if using Automatic Data Encryption (ADE) please remember that a READ failure does not always mean a record is not on file, it can also mean a decryption failure if the appropriate encryption keys are not activated for the user session concerned.

    Please use ON ERROR and STATUS() appropriately, noting that with ADE you can also get an encryption error on a WRITE for the same reason.

    Regards

    JJ

    ------------------------------
    John Jenkins
    Principal Technical Support Engineer
    Rocket Software Limited
    U.K.
    ------------------------------



  • 5.  RE: Comparing records in different files

    Posted 06-27-2022 08:58
    A helpful reminder. Thank you.

    ------------------------------
    Shawn Waldie
    enterprise application developer
    Rocket Forum Shared Account
    Los Angeles CA US
    ------------------------------