0

I am trying to connect to a mainframe from linux server using sftp command and execute a SITE command and transfer file to mainframe, but it is failing and showing Invalid command.

I am using batch operation mode as sftp -b $batch_file user@remote_user.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
rks
  • 1
  • 1
  • Which specific SITE command? Most of them make no sense in the context of SFTP. – Michael Hampton Aug 14 '16 at 09:24
  • i am setting `RECFM=FB` and `LRECL=243` at mainframe end, i was able to do in ftp but in sftp it is showing invalid comand – rks Aug 14 '16 at 09:27
  • 1
    There's no such command in sftp. It's a completely different protocol, and it only treats files as streams; it doesn't have any way to transmit record size information. I'm not sure if there is a solution for this. – Michael Hampton Aug 14 '16 at 09:34
  • Is this truly an IBM i series machine or is it a z series machine? The latter has sftp extensions to handle your needs. – cschneid Aug 14 '16 at 14:59

1 Answers1

0

The 'SITE' commands are effectively server-bound and specific to FTP. Your FTP application is ignorant of the meaning of the content within the SITE command. When you pass SITE like this to a mainframe, you are passing arbitrary file meta info about how the files should be allocated on the mainframe. The mainframe can then take the incoming file and reformat it according to the specified allocation.

For SFTP you need to do the format changes for the file before sending it. If you are on a *nix box, you can easily do this with the DD command (block parameter) so long as the lines break easily. Anything more complex and you might look at doing it with Perl, etx.

colson
  • 116
  • 2