SSH

Fetching a remote file into an MVS data set

This example (SCPGET from SAMPLIB) executes scpg3 and copies a remote file (file.bin) into a data set (//'USER.TEST.BINFILE'). If the data set does not exist, it is created with default values recfm VB and lrecl 1024.

The stdout and stderr message files are printed to SYSOUT. Required environment variables are supplied in SSHENV via STDENV DD. Modify the DD statement according to your requirements.

//SCPGET  EXEC PGM=BPXBATSL,REGION=0M
//STDPARM  DD  *
PGM /opt/tectia/bin/scpg3
  user@remote:file.bin
  //'USER.TEST.BINFILE'
//STDENV   DD  DSN=<HLQ>.V650.PARMLIB(SSHENV),DISP=SHR
//STDOUT   DD  SYSOUT=*
//STDERR   DD  SYSOUT=*
//STDIN    DD  DUMMY
//

The same file transfer can be carried out using sftpg3 in batch mode (-B option):

//SFTPGET  EXEC PGM=BPXBATSL,REGION=0M
//STDPARM  DD  *
PGM /opt/tectia/bin/sftpg3 -B //DD:STDIN
  user@remote
//STDENV   DD  DSN=<HLQ>.V650.PARMLIB(SSHENV),DISP=SHR
//STDOUT   DD  SYSOUT=*
//STDERR   DD  SYSOUT=*
//STDIN    DD  *
sget file.bin //'USER.TEST.BINFILE'
//