Suppose
1. mainframe $HOST
2. mainframe $USER/$PASSWORD
3. mainframe source dataset $USER.TEST.DATA.FILE
4. local destination file: local.data
// Sample 1: Get a text file, for example a JCL JOB, COBOL program
ftp -v -n<<EOF
open $HOST
user $USER $PASSWORD
prompt
asc
get TEST.DATA.FILE local.data
close
bye
EOF
If the dataset fullpath is with other <UID>, you could wrapper the dataset name with apostrophe, like
get '<UID>.TEST.DATA.FILE' local.data
// Sample 2: get a binary fixed record sequential dataset
ftp -v -n<<EOF
open $HOST
user $USER $PASSWORD
prompt
binary
get TEST.DATA.FILE local.data
close
bye
EOF
// Sample 3: get a binary variable record sequential dataset
ftp -v -n<<EOF
open $HOST
user $USER $PASSWORD
prompt
binary
quote site rdw
cd TEST.DATA
get FILE local.data
close
bye
EOF
After a variable length sequential dataset is downloaded, the file header is removed, so on unix, the beginning of the dataset is first record's record header.