Skip to main content
Jan 10, 2019 6:20 PM UTC

cURL PUT with --data-binary from z/Os

I am attempting to PUT a z/OS load module on a Linux system into a repository to be pulled later and run on z/OS. I am using
curl -X PUT -k -u userid:passowrd
-v -T --data-binary @/folder/Jzosfile.so
“https://dnsname/path/filename”

I get an error “curl: Can’t open ‘–data-binary’!”. Is this not a valid option on PUT? I see people asking questions about cURL POST with --data-binary but not PUT.

Any suggestions on how to put a file in binary from cURL? I do it all the time FTP but what I am putting this do does not support FTP.

Thank you

    4 replies

    Sergey Rezepin
    Rocketeer
    Jan 14, 2019 10:24 AM UTC

    I am attempting to PUT a z/OS load module on a Linux system into a repository to be pulled later and run on z/OS. I am using
    curl -X PUT -k -u userid:passowrd
    -v -T --data-binary @/folder/Jzosfile.so
    “https://dnsname/path/filename”

    I get an error “curl: Can’t open ‘–data-binary’!”. Is this not a valid option on PUT? I see people asking questions about cURL POST with --data-binary but not PUT.

    Any suggestions on how to put a file in binary from cURL? I do it all the time FTP but what I am putting this do does not support FTP.

    Thank you

    Hi,

    If you use -T or --upload-file option, PUT will be use by default for HTTPS.
    –data-binary is using for POST requests but it can be changed to PUT:
    https://ec.haxx.se/http-put.html
    If you want to upload file on FTP or HTTP server, you need to run:
    curl -u userid:password -v -T /folder/Jzosfile.so “ftp://dnsname/path/filename”
    or
    curl -k -u userid:password -v -T /folder/Jzosfile.so “https://dnsname/path/filename”
    or
    curl -k -u userid:password --data-binary “@/folder/Jzosfile.so” -X PUT “https://dnsname/path/filename”

    The binary transfer mode is default for curl if you are using -T(–upload-file) option.
    But there is an another problem - a bug connected with binary mode. The uploaded file can be coverted to another encoding.
    Unfortunately, this bug is not fixed yet.

    Thanks,
    Sergey

    Jan 14, 2019 10:53 AM UTC

    Hi,

    If you use -T or --upload-file option, PUT will be use by default for HTTPS.
    –data-binary is using for POST requests but it can be changed to PUT:
    https://ec.haxx.se/http-put.html
    If you want to upload file on FTP or HTTP server, you need to run:
    curl -u userid:password -v -T /folder/Jzosfile.so “ftp://dnsname/path/filename”
    or
    curl -k -u userid:password -v -T /folder/Jzosfile.so “https://dnsname/path/filename”
    or
    curl -k -u userid:password --data-binary “@/folder/Jzosfile.so” -X PUT “https://dnsname/path/filename”

    The binary transfer mode is default for curl if you are using -T(–upload-file) option.
    But there is an another problem - a bug connected with binary mode. The uploaded file can be coverted to another encoding.
    Unfortunately, this bug is not fixed yet.

    Thanks,
    Sergey

    Hi Sergey and thank you for the response.

    I am using the -T on my PUT request.

    The product I am doing the upload to Artifactory does not support FTP or I would be using that, with or without cURL.

    What are the results of the -a bug connected with binary mode? I am attempting to determine when this EBCDIC file is being converted to ASCII.

    Regards

    Kevin

    Jan 17, 2019 11:19 AM UTC

    I am attempting to PUT a z/OS load module on a Linux system into a repository to be pulled later and run on z/OS. I am using
    curl -X PUT -k -u userid:passowrd
    -v -T --data-binary @/folder/Jzosfile.so
    “https://dnsname/path/filename”

    I get an error “curl: Can’t open ‘–data-binary’!”. Is this not a valid option on PUT? I see people asking questions about cURL POST with --data-binary but not PUT.

    Any suggestions on how to put a file in binary from cURL? I do it all the time FTP but what I am putting this do does not support FTP.

    Thank you

    Hi Kevin.

    Just my 2ct.
    I got a similar problem and over here I had to change the @ to § because of Codepage mismatch.

    regards michael

    Jan 30, 2019 8:59 AM UTC

    Hi Kevin.

    Just my 2ct.
    I got a similar problem and over here I had to change the @ to § because of Codepage mismatch.

    regards michael

    Thank you I saw that in another thread you posted. It was the first thing I tried. I am using a heavy handed work around now. I use FTP bin to put my load modules on a Unix FTP server then a cURL POST from the mainframe that kicks off a script to get it to its build destination. It works and keeps it all in EBCDIC format.