Error with LFTP

I use below ftp command to push the file from UNIX server to Mainframe system.

(lftp -d -e "set ftp:passive-mode false; put -a ${SPOOLFILE} -o ${FNAME}; exit" -u ${id},${paswd} ${host} ) >> $ftplog

To ftp the file successfully i need to get the out put for FNAME as

 "'filename'" 

(double quote followed by single quote filename then single quote followed by double quote).

I tried assigning below format for FNAME but i could get the format as required.

 

FNAME="\"'filename'"\"

o/p FNAME="'\''filename'\''"


FNAME=\"'filename'\"

o/p FNAME="'\''filename'\''"


FNAME="\"'filename'\""

o/p FNAME= "filename"


FNAME="\""'"filename"'"\""

o/p FNAME= "'\''filename'\''"

 

Can anyone help me to get the required quote in put command.

Hmmm - where exactly is the problem?

FNAME="\"'filename'"\"
echo "${FNAME}"
"'filename'"

Isn't this what you need?

I have problem when executing the lftp command. we get correct format when echo in variable but when executing through lftp FNAME not having same formatting. i tried four different formatting condition in FNAME variable but no luck. Results are given in o/p.

What "problem when executing the lftp command"? Show the error and messages verbatim, char by char. You may want to set the -xtrace option when executing the script to get a better feeling what is actually happening.
How are the "Results ... given in o/p." obtained?

Script which i use

FNAME="\"'FDSD109.PRD.SARS.WRKS.GBLCDS'"\"
echo $FNAME
ftplog=$WHOME/output/ftp_${FILE_NAME}${FILE_SUFFIX}
(lftp -d -e "set ftp:passive-mode false; put -a ${SPOOLFILE} -o ${FNAME}; exit" -u ${id},${paswd} ${host} ) >> $ftplog

Output when executing

+ FNAME='"'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"'
+ echo '"'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"'
"'FDSD109.PRD.SARS.WRKS.GBLCDS'"
+ ftplog=/output/ftp_FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144
+ >>output/ftp_FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144

+ lftp -d -e 'set ftp:passive-mode false; put -a Extract/EIS/files/FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144 -o "'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"; exit' -u xxxx,yyyy zzz.zzz.com
---- Connecting to zzz.zzz.com  port 21
<--- 220-NTFTP1 IBM FTP CS V2R1 at zzz.zzz.COM, 11:11:45 on 2018-05-20.
<--- 220 Connection will close if idle for more than 10 minutes.
---> FEAT
<--- 211- Extensions supported
<---  AUTH TLS
<---  PBSZ
<---  PROT
<--- 211 End
---> AUTH TLS
<--- 234 Security environment established - ready for negotiation
---> USER xxxx
<--- 331 Send password please.
---> PASS yyyy
<--- 230 xxxx is logged on.  Working directory is "xxxx.".
---> PWD
<--- 257 "'xxxx.'" is working directory.
---> PBSZ 0
<--- 200 Protection buffer size accepted
---> PROT C
<--- 536 Data connection protection clear not supported
---> PORT 19,111,6,226,133,20
<--- 200 Port request OK.
---> ALLO 2042285
<--- 202 ALLO not necessary, you may proceed
---> STOR 'FDSD109.PRD.SARS.WRKS.GBLCDS'
<--- 425-Server requires protected data connection.
<--- 425 Can't open data connection.
---- Closing data socket
---> PORT 19,111,6,226,227,163
<--- 200 Port request OK.
---> STOR 'FDSD109.PRD.SARS.WRKS.GBLCDS'
<--- 425-Server requires protected data connection.
<--- 425 Can't open data connection.
 

Did you try without ANY quoting of the file name?
Are you sure the failure is caused by the file name, NOT by e.g. a firewall or a protection setting that blocks the "data connection" due to "protection clear"?