Search code examples
mainframezosrexxomvs

FSUM7332 - expecting new line when using bpxwunix under z/OS


sftp 1216: FSUM7332 syntax error: got ), expecting Newline

I've created a 'batch' file for sftp in REXX and have used the address syscall writefile to write out the data to the file.

the sftp is invoked using bpxwunix thus: sftp -b batchfile userid@host

The file is created thus:

stdin = workdir'/'sysvar('sysuid')'.sftp.stdin' 
out.1 = 'put' workdir'/'filename                
out.2 = 'quit'                                  
out.0 = 2                                       
address syscall 'writefile (stdin) 700 out.'  

I tried to add '25'x at the end of each stem line without success.


Solution

  • I can answer why you get an error when running bpxwunix with the command passed being sh sftp ....:

    bpxwunix starts a shell as if sh -c command has been typed, where command is the first parameter to bpxwunix. If you pass sh sftp ... as the command, bpxwunix will start a shell as sh -c sh sftp ..., so the shell command to be run is sh.

    If sh is called that way, the first word is taken as a shell command file, from which the shell tries to read commands. In your case, the shell tries to read commands from file sftp, which is a binary. The error you get is arbitrary, and depends on the bytes read from the file. Try sending sh ls as command to bpxwunix, and you get some different error.