Skip to content

Quote and Literal subcommands are implemented#34

Merged
shugo merged 3 commits into
ruby:masterfrom
mslinn:quote
Jun 1, 2024
Merged

Quote and Literal subcommands are implemented#34
shugo merged 3 commits into
ruby:masterfrom
mslinn:quote

Conversation

@mslinn

@mslinn mslinn commented May 2, 2024

Copy link
Copy Markdown
Contributor

Fixes #33

@mslinn

mslinn commented May 3, 2024

Copy link
Copy Markdown
Contributor Author

The modifications in the pull request have been tested against an IBM z/OS Communications Server. The following code fragment uses FTP to submit a batch job to the mainframe, and collects the results.

def parse_job_number_from(line)
  tokens = line.split('JOB')
  raise StandardError, "Error: The string 'JOB' was not found in the FTP response." unless tokens.length == 2

  job_number = tokens[1].split.first
  job_number.sub(/^0+/, '') # Remove leading zeros
end
    
Net::FTP.open(@ip_or_domain) do |ftp|
  ftp.login @uid, @pwd
  ftp.quote 'site filetype=jes'
  job_info = ftp.puttextfile @local_jcl_filepath
  job_number = parse_job_number_from job_info
  ftp.gettextfile "J#{job_number}", @local_results_file
end

@shugo
shugo merged commit d7e97c2 into ruby:master Jun 1, 2024
@shugo

shugo commented Jun 1, 2024

Copy link
Copy Markdown
Member

It looks good. Thank you!

headius added a commit to headius/jruby that referenced this pull request Jun 27, 2024
net-ftp 0.3.6+ returns the response from `put` and `puttextfile`.

See ruby/net-ftp#34
@mslinn

mslinn commented Jun 28, 2024

Copy link
Copy Markdown
Contributor Author

The version of the net-ftp Ruby gem containing this PR was tagged as v0.3.6. Looks like v0.3.6 was not released and there were no change notes. There was no mention of this pull request in v0.3.7 either, although the code from this PR is there. Seems like the credit for my contribution fell through the cracks. Might it be possible to fix that somehow?

@shugo

shugo commented Jun 28, 2024

Copy link
Copy Markdown
Member

@mslinn
It seems that v0.3.6 release was left as draft.
I've just published it: https://github.com/ruby/net-ftp/releases/tag/v0.3.6

@mslinn

mslinn commented Jun 28, 2024

Copy link
Copy Markdown
Contributor Author

@shugo Many thanks!

andrykonchin pushed a commit to ruby/spec that referenced this pull request Jul 1, 2024
net-ftp 0.3.6+ returns the response from `put` and `puttextfile`.

See ruby/net-ftp#34
@mslinn

mslinn commented Oct 9, 2024

Copy link
Copy Markdown
Contributor Author

I noticed that the sample code I showed above from May 3 does not appear in the documentation. How might that be accomplished?

@shugo

shugo commented Oct 10, 2024

Copy link
Copy Markdown
Member

I noticed that the sample code I showed above from May 3 does not appear in the documentation. How might that be accomplished?

What do you mean by the words "the sample code I showed above from May 3"?
It seems that documentation returned by ri and gem server contains description in your patch, but I couldn't find "sample code" in your patch.

$ ri Net::FTP#quote
= Net::FTP#quote

(from gem net-ftp-0.3.8)
=== Implementation from FTP
------------------------------------------------------------------------
  quote(arguments)

------------------------------------------------------------------------

The "quote" subcommand sends arguments verbatim to the remote ftp
server. The "literal" subcommand is an alias for "quote". @param
arguments Array[String] to be sent verbatim to the remote ftp server

@mslinn

mslinn commented Oct 10, 2024

Copy link
Copy Markdown
Contributor Author

Here is the documentation again:

The modifications in the pull request have been tested against an IBM z/OS Communications Server. The following code fragment uses FTP to submit a batch job to the mainframe, and collects the results.

def parse_job_number_from(line)
  tokens = line.split('JOB')
  raise StandardError, "Error: The string 'JOB' was not found in the FTP response." unless tokens.length == 2

  job_number = tokens[1].split.first
  job_number.sub(/^0+/, '') # Remove leading zeros
end
    
Net::FTP.open(@ip_or_domain) do |ftp|
  ftp.login @uid, @pwd
  ftp.quote 'site filetype=jes'
  job_info = ftp.puttextfile @local_jcl_filepath
  job_number = parse_job_number_from job_info
  ftp.gettextfile "J#{job_number}", @local_results_file
end

headius pushed a commit to headius/spec that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the 'literal' or 'quote' subcommands

2 participants