To give the background, I am a mainframe application programmer. We have SFTPs in system with both the flavors (single file pick-up or multiple file pick-up). I understand the single file pick-up is a straight forward GET command, but for multiple file Pick-up below code is required in COZBATCH. By running the code I understood that below "get" and "rm" commands go in loop (means a file is selected based on a pattern, that file gets into the dataset and then gets deleted), but if someone can help me understand below awk programming, that would be great. Also I want to display the file in job output just before removing it, so I did try "!cat" between "get" and "rm". Seems like it works good on a single file and doesn't work in below, do we have any other option to try by which I can achieve displaying the file just before removing it?
Code: Select all
{
$coz_bin/cozsftp $ssh_opts -b- $r_user@$r_server <<EOB
ls -l $r_pattern
EOB
} | awk '
BEGIN {
print "lzopts " ENVIRON["zopts"]
skip = 1
}
{
if (skip == 1) {
if ($1 == "cozsftp>") skip = 0
next;
}
print "get " $9 " //DD:GETFILE"
print "rm " $9
}' | $coz_bin/cozsftp $ssh_opts -b- $r_user@$r_server
Thanks and Regards,
Chaky.