Problem of CTRL-C while FTP

skunal

Member
I have a program which has one variable defined as Def var a as int. ( There is no NO-UNDO) . And when in code i have return code in repeat loop and when the code is before FTP and i press CTRL-C the value is getting UNDONE but when user presses the ctrl-c when in FTP process the value is not getting restored.Can someone please help me on this. Below is the code sample...

Code:
define variable l_seq        as integer.

repeat on error undo, retry:
---------------------
--------------
(User presses ctrl-c it works fine value of l_seq is restored)
/* FTP logic */
output to value(l_script).
         put unformatted
            trim(code_value) > log.txt 2>&1 skip
            trim(code_cmmt)  skip
            "put " l_op_file  skip
            "bye"   skip
            "Try"   skip.
      output close.
      
(User presses ctrl-c when FTP process is executing the value is not UNDONE ...)
     
      unix   silent chmod 777    value (l_script).
      unix   silent    ksh       value (l_script).
      unix   silent    rm        value (l_script).

END. /*Repeat */
 

rzr

Member
I'm assuming you were refering to the variable "l_seq", but in your code this variable is not used anywhere.

How abt trapping the CTrl-C and taking appropriate actions - would that help?

Code:
[FONT=courier new]DO ON STOP UNDO ,RETRY
   ON ERROR UNDO, LEAVE:

   IF RETRY THEN DO:
      MESSAGE 'CTRL-C Pressed' /*Take Action*/
      VIEW-AS ALERT-BOX INFO BUTTONS OK.
      RETURN.
   END.

   WAIT-FOR "CLOSE" OF THIS-PROCEDURE.
END.[/FONT]
 

Cringer

ProgressTalk.com Moderator
Staff member
Is there any reason you are using output for this and not OS-COMMAND?

I'm guessing that what is happening that a CTRL-C during the FTP part is being handled by the FTP client and not Progress. As a result, Progress thinks the output operation has completed succesfully so doesn't roll back the block.
 

rzr

Member
true... and maybe check for the return code value when the FTP fails and UNDO whatever has to be undone accordingly based on the return code.
 

skunal

Member
hi thanx for ur replies i handled this situation by checking the log file generated while doing FTP(log.txt)...and then undo that variable.......
 
Top