1

I want to use unix command in SQR to zip/ compress a file with password and after that verifying password option

3 Answers3

0

SQR can run commands for the platform it runs on - use the "call system" command. I have used this in Unix to run a mail command.

I'll just show you the code from my program for some of it and I hope it helps:

Let $Mail_Command = 'echo ' || $body || ' | mailx -s ' || $Subject || ' -r ' || $from || ' ' || $to 

! This is the key command you're looking for    
call system using $Mail_Command #Send_Status wait

If #Send_Status <> 0
        show ' '
        show 'ERROR sending email to : ' $to ' $From: ' $From ' $Subject: ' $Subject  
        show $Mail_Command
        show 'system stat: ' #Send_Status
        show ' '
   else
        #debug  show ''
        #debug  show 'Email sent to  : ' $to ' $From: ' $From ' $Subject: ' $Subject  
        #debug  show '$Body:     <' $Body '>'
   end-if
cardmagik
  • 1,698
  • 19
  • 17
0

You will have to use the 'Call system' command in your SQR file. The syntax for the same being -

$cmd_string = '<Command here>'
Call System using $cmd_string #status

#status variable could be used for exception/error handling.

To zip files with a password in a unix environment, you will have to use the zip command, or similar commands. zip, when used with the parameter -P will give you a zip encrypted with the password provided. Check the documentation here - http://linux.about.com/od/commands/l/blcmdl1_zip.htm

navi
  • 179
  • 1
  • 7
0

I was also looking for a file compression technique in SQR using the CALL SYSTEM USING command.

I tried the zip command first but it did not work. Later I tried using gzip and it worked, and the only disadvantage with the gzip command is that it will delete the original file. Below is the code I used:

let $zipcmd  = 'gzip' ||' '|| $OutputFileName
CALL SYSTEM USING $zipcmd #Status WAIT
Don Cruickshank
  • 5,641
  • 6
  • 48
  • 48