z/OS Tools & Language

Expand all | Collapse all

Curl output format when called from BPXWUNIX

  • 1.  Curl output format when called from BPXWUNIX

    Posted 02-12-2018 07:06

    Hi.

    Running Rocket curl 7.52.1 on z/OS 2.2. Calling curl from a REXX running in TSO via the BPXWUNIX program as in the following example:

    /rexx/
    cmd=’/rocket/bin/curl’,
    http://www.yahoo.com -i’
    stdin.0=0
    stdout.0=0
    stderr.0=0
    env.1=’_BPXK_AUTOCVT=ON’
    env.2=’_CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)‘
    env.3=’_TAG_REDIR_ERR=txt’
    env.4=’_TAG_REDIR_IN=txt’
    env.5=’_TAG_REDIR_OUT=txt’
    env.0=5
    call bpxwunix cmd,“stdin.”,“stdout.”,“stderr.”,"env."
    say "BPXWUNIX RC="result;
    say;say “STDOUT >”;say
    do i=1 to stdout.0;say stdout.i;end
    say;say “STDERR >”;say
    do i=1 to stderr.0;say stderr.i;end

    Depending on the URL passed to curl the output looks something like the following:

    BPXWUNIX RC=0

    STDOUT >

    :::&:::::::::|.:::/::::(?>::::::::::::::::::::::::(::::::::::::(?>:::::::::::::::::::
    :::>:::::::/>::::::>:?::>::::::>,:::::?>::>::::::::::::::%/:>:::::>,>?:>:::::::::

    STDERR >

    :::::?:/%::::::::::::::::::::::::::::/::::::::::::::::::::::::::::_::::::::>:::::::
    :/%::::::>:::::<:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::

    Piping the curl command through iconv does not produce legible EBCDIC.

    If the environment variables are removed (env.0=0) and the curl command piped through iconv then the STDOUT is legible EBCDIC. Nothing seems to make STDERR legible.

    Are there missing environment variables or some other config?
    Is this a similar issue to curl running under BPXBATCH?
    Will a future release of curl correctly support character set translation in the BPXWUNIX program?
    Any ETA on a new release?

    Thanks, Richard.



  • 2.  RE: Curl output format when called from BPXWUNIX

    Posted 02-13-2018 08:31

    Hi Richard,

    Could you run curl under bash and put the curl command in the double quotes?

    /* rexx */

    bash=’/rsusr/ported/bin/bash -c "‘
    cmd=’/rsusr/ported/bin/curl’,
    http://www.yahoo.com -i "‘
    stdin.0=0
    stdout.0=0
    stderr.0=0
    env.1=’_BPXK_AUTOCVT=ON’
    env.2=’_CEE_RUNOPTS=FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)‘
    env.3=’_TAG_REDIR_ERR=txt’
    env.4=’_TAG_REDIR_IN=txt’
    env.5=’_TAG_REDIR_OUT=txt’
    env.0=5
    call bpxwunix bash cmd,“stdin.”,“stdout.”,“stderr.”,"env."
    say "BPXWUNIX RC="result;
    say;say “STDOUT >”;say
    do i=1 to stdout.0;say stdout.i;end
    say;say “STDERR >”;say
    do i=1 to stderr.0;say stderr.i;end

    The stdout in this case:

    STDOUT >

    HTTP/1.1 301 Moved Permanently:
    Date: Tue, 13 Feb 2018 11:05:28 GMT:
    Connection: keep-alive:
    Via: http/1.1 media-router-fp27.prod.media.bf1.yahoo.com (ApacheTrafficServer :
    c s f :):
    Server: ATS:
    Cache-Control: no-store, no-cache:
    Content-Type: text/html:
    Content-Language: en:
    X-Frame-Options: SAMEORIGIN:
    Location: https://www.yahoo.com/:
    Content-Length: 8:
    :
    redirect

    STDERR >

    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    : 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
    :100 8 100 8 0 0 90 0 --:–:-- --:–:-- --:–:-- 186

    Thanks,
    Sergey



  • 3.  RE: Curl output format when called from BPXWUNIX

    Posted 02-13-2018 09:10

    And could you please say what build of curl you are using?
    It should be fixed for 006 build.



  • 4.  RE: Curl output format when called from BPXWUNIX

    Posted 02-13-2018 19:44

    Hi Sergey, thanks for the info.

    Looks like we are running build 4 of curl so I’ll upgrade and test again.

    I tried passing the curl command to bash and got the same result as before - something other than EBCDIC.

    I’ll let you know the build 6 outcome.

    Richard.



  • 5.  RE: Curl output format when called from BPXWUNIX

    Posted 02-28-2018 08:36

    Installed curl 7.52.1 Build 6 and the problem is resolved. Thank you.

    One thing I did notice however is that the environment variables my REXX set up no longer appear to be required. I can remove them and I get EBCDIC back which is what I want. Including them or not including them seems to make no difference. It’s like curl has gone back to how it was before ASCII and file tagging support was added.

    The supplied docs say that the environment variables should be defined.

    Is this working as designed?

    Richard.



  • 6.  RE: Curl output format when called from BPXWUNIX

    Posted 03-05-2018 07:40

    Yes, it is.
    You may remove them, but if you create a new files by curl (redirecting output into the file, for example: -o option), it create an ASCII-tagged file by default.
    In a further process, the ASCII-tagged file won’t be read without auto-converting options correctly.
    It’s recommended to set them.



  • 7.  RE: Curl output format when called from BPXWUNIX

    Posted 06-05-2018 20:09

    Hi,

    I have the same problem so was hoping to try out build 6. However, the download page only have source code for build 6 - the last distribution is build 3. Is build 6 available in distribution form? As we are not licensed for the C compiler so having just source is no good to me.

    Regards,
    Thomas



  • 8.  RE: Curl output format when called from BPXWUNIX

    Posted 06-25-2018 21:59

    Hi, I know I (and the company I work for) don’t have any support agreement with Rocket on the open source tools, but would have thought at least I could get an answer to a very simple question about getting hold of build 6 distribution, since not every shop is licensed for C compiler so getting the source alone for the build is of no use at all.

    Regards,
    Thomas



  • 9.  RE: Curl output format when called from BPXWUNIX

    Posted 06-26-2018 07:15

    Hi, Thomas. The current download for 7.52.1 build 6 is incorrectly described as a source distribution; it does, in fact, contain the curl binaries and libraries.



  • 10.  RE: Curl output format when called from BPXWUNIX

    Posted 06-26-2018 20:05

    Thanks Jerry. Indeed it contains the binaries as well.