I have been using your AS400 documentation for many years. First of all, a big thank you from Germany.
Now to my problem. I want to transfer data to an external server via SCP command. This works if I enter the SCP command fixed in the script, as soon as I want to control the transfer by variable, I get error 127 and the command fails.
Working script without variables:
Code: Select all
#!/bin/sh
export DISPLAY= SSH_ASKPASS=/QOpenSys/etc/openssh_password_scp_script.sh
printf | scp -P 2231 /home/Shop/wf/SFTP00_TST.txt bhk_wawi@OXIDADMIN.BASLER-BEAUTY.DE:/data/data/wawi/...........
password
Not working with variable:
Code: Select all
#!/bin/sh
export DISPLAY= SSH_ASKPASS=/QOpenSys/etc/openssh_password_scp_script.sh
printf | "${SSH_CMD}"
echo $?
Code: Select all
--> Result:
password/home/scpuser/V0_batch_scp_script_mit_Parameter.sh[3]: scp -P 2231 /home/Shop/wf/SCP00_TST.txt bhk_wawi@OXIDADMINN.BASLER-BEAUTY.DE:/data/data/wawi/........
127
Code: Select all
CHGVAR VAR(&AS400VERZ) VALUE('/home/Shop/wf/')
CHGVAR VAR(&AS400FILE) VALUE('SCP00_TST.txt')
CHGVAR VAR(&OXIDUSER) VALUE('bhk_wawi')
CHGVAR VAR(&OXIDSERVER) VALUE('OXIDADMIN.BASLER-BEAUTY.DE')
CHGVAR VAR(&OXIDVERZ) VALUE('/data/data/wawi/Basler2Shop/customerDE/backup/wf/file.txt')
CHGVAR VAR(&SCP_CMD) VALUE(' scp -P 2231' *BCAT +
&AS400VERZ *TCAT +
&AS400FILE *TCAT ' ' *CAT +
&OXIDUSER *TCAT '@' *CAT +
&OXIDSERVER *TCAT ':' *CAT +
&OXIDVERZ)
ADDENVVAR ENVVAR(SSH_CMD) VALUE(&SCP_CMD) REPLACE(*YES)
QSH +
CMD('/QOpenSys/etc/openssh_password_scp_script.sh')
QSH CMD('exec /QOpenSys/usr/bin/ksh -c +
"/home/scpuser/V0_batch_scp_script_mit_Parameter.sh"')
Best regards
Wolfgang