Data Replication

Expand all | Collapse all

CHCCLP script - error handling

  • 1.  CHCCLP script - error handling

    Posted Thu May 14, 2020 03:50 PM
    I have a script that unlocks subscriptions. But if the subscription is already unlocked it errors out and stops processing at that line. I'd like to code such that if it is already unlocked, it should ignore the error and treat it as a warning and proceed to the next step. Whats the best way handling such conditions?
    Thank you.

    ------------------------------
    Manas Dasgupta
    ------------------------------


  • 2.  RE: CHCCLP script - error handling

    Posted Thu May 14, 2020 07:32 PM
    Good day Manas: 

    I don't know if this is the kind of answer you expect, but for having a better control on errors I will prefer to do it in Java.  There is an IBM Redbook plenty of programming samples: SG24-7941. It is quite old, but the techniques are basically the same.  In the <idr-install-path>/docs/api you will find the javadoc for the IDR java API.

    Anyway, I hope someone has a better idea on how to manage errors in CHCCLP.

    ------------------------------
    DANIEL JOSE LEMA GUANZIROLI
    ------------------------------



  • 3.  RE: CHCCLP script - error handling

    Posted Fri May 15, 2020 06:56 AM
    Thanks Daniel & Frank.

    That's what I feared I'd have to do.

    ------------------------------
    Manas Dasgupta
    ------------------------------



  • 4.  RE: CHCCLP script - error handling

    Posted Fri May 15, 2020 03:38 PM
    Hello Manas

    I think you have a couple of options outside of Java
    1. In the current case. could you not simply break your chcclp script into 2 parts - one to just unlock and the second to do the rest of the processing? Then if the unlock fails because the subscription is not locked it does not matter because the 2nd script will kick in
    2. If you are invoking your CHCCLP script from a shell script or batch script you could redirect output from chcclp to a file and then scan the file for any errors e.g. grep \[ERR and take appropriate action

    ------------------------------
    Robert Philo
    ------------------------------



  • 5.  RE: CHCCLP script - error handling

    Posted Thu May 14, 2020 07:40 PM
    I would then recommend to use embedded CHCCLP, invoked from Java. The class/method can then do the error handling of the CHCCLP script.

    ------------------------------
    Frank Ketelaars
    ------------------------------



  • 6.  RE: CHCCLP script - error handling

    Posted Fri May 15, 2020 03:34 PM
    Hello If you do not want to use Java but you are invoking chcclp scripts from a batch file or shell script you have a couple of options

    1) Break up your chcclp processing into 2 script
          a) The first script unlocks the table. If it errors because the table is already unlocked it does not matter
          b) The second script does the rest of the processing
    2) More generally execute your chcclp script and check for any errors (scan string would be \[ERR in Linux/UNIX) Then you can code explicit recovery or user notification messages on detecting an error

    ------------------------------
    Robert Philo
    ------------------------------



  • 7.  RE: CHCCLP script - error handling

    Posted Wed May 20, 2020 07:37 AM
    Thanks Robert. I have 4 subs and if the first one is already unlocked the processing ends there. So I have to break it down into 4 clp scripts just to be able to unlock successfully. I have run into same issue with "start mirror". Interestingly "end mirror" does not error out if the mirroring is already stopped for the sub.
    Thanks,
    Manas.

    ------------------------------
    Manas Dasgupta
    ------------------------------



  • 8.  RE: CHCCLP script - error handling

    Posted Wed May 20, 2020 08:05 AM
    Hi Manas,

    Just a heads-up that there is a "wait" option for start mirror and end mirror. It wouldn't help with subs that are locked, but might help on other issues.

    Here is the syntax:

    [wait]                     Specifies how long to wait (in seconds) for 
                                 mirroring to start/end before continuing with script 
                                 execution. Use -1 to wait indefinitely, 0 for no 
                                 wait, or maximum number of seconds to wait before continuing.
                                 DEFAULT:
                                     0


    ------------------------------
    SARAH ORVIS
    ------------------------------