z/OS Tools & Language

Expand all | Collapse all

Can't Write to z/OS Datasets with Perl 5.22 using OS390::Stdio

  • 1.  Can't Write to z/OS Datasets with Perl 5.22 using OS390::Stdio

    Posted 08-19-2016 09:48

    Hey guys,

    I recently upgraded from Perl 5.00503 to 5.22.0. I am using the OS390::Stdio package included with the install to process z/OS datasets record by record. Previously, I was able to open my output dataset as follows:

    my $outfh = mvsopen("//‘USERBTC.OUTPUT.FILE’",“wb, lrecl=105”) or die $!;

    and write to it with:

    mvswrite($outfh, $record, 105) or die $!;

    However when using Perl 5.22.0, I am now getting an Abend S0C4-X’4’ (Protection Exception) error while using mvswrite(), unless I remove the lrecl=105 parameter from mvsopen().
    When I remove the parameter, mvsopen() creates a dataset with lrecl=80 and wraps the 105 byte input record across two output records.

    Does anybody know if keyword parameters are supported in mvsopen() for Perl 5.22.0, and if so how do I specify them?


  • 2.  RE: Can't Write to z/OS Datasets with Perl 5.22 using OS390::Stdio

    Posted 08-25-2016 07:04

    mvsopen() function is a wrapper function for fopen() (see http://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/fopen.htm)

    This Abend S0C4-X’4’ appears to be an error where incorrect parameters for creating dataset.

    Which version of z/OS and OS390::Stdio are being used?
    Also, you were using a very old (5.0053) version of Perl. You may want a staged upgrade starting with 5.8.6 which has been installed by default since z/OS 1.19.

    What are the parameters used for fopen() ?
    What default settings to create a dataset ?

    lrecl parameter must be a multiple of the parameter blksize. Check that your lrecl parameter is in the limits
    for the type of dataset you are opening.


  • 3.  RE: Can't Write to z/OS Datasets with Perl 5.22 using OS390::Stdio

    Posted 08-30-2016 10:11

    Hey Peter,

    I am able to write to the z/OS dataset when using fopen() and fwrite() directly, e.g.:

    FILE *stream = fopen("//‘USERBTC.OUTPUT.FILE’",“wb, lrecl=105”);

    I am using z/OS 2.2 and OS390:Stdio 0.008, which I believe is the lateset version, and I do have Perl 5.8.6 installed as the standard Perl on the system, but I was using Perl 5.00503 by pointing to it directly.

    I should have given you the full error message for the SOC4, it says:

    The system detected a protection exception (System Completion Code=0C4).
    From entry point PerlIO_findFILE at compile unit offset +00000076 at entry offset +00000076 at address 122B623E

    I saw in the source code for mvsopen http://cpansearch.perl.org/src/PVHP/OS390-Stdio-0.008/Stdio.xs that it executes differently depending on whether the USE_PERLIO macro is defined. The difference is that when USE_PERLIO is defined:

    pio_fp = PerlIO_importFILE(fp,mode);

    is executed.

    In my PERLLIB for 5.00503, PerlIO.pm and PerlIO/ are not present, but in my PERLLIB for 5.8.6 and 5.22.0 they are, so I’m guessing that USE_PERLIO is not defined in the 5.00503 installation, but is for 5.8.6 and 5.22.0.

    I am only able to write to z/OS datasets with 5.00503.
    So I would guess that there is some problem with PerlIO_importFILE(), or how OS390::Stdio mvsopen uses it that is causing this issue. Do you think this is correct?

    Thanks for your help,

  • 4.  RE: Can't Write to z/OS Datasets with Perl 5.22 using OS390::Stdio

    Posted 09-06-2016 09:44

    Hi Brandon,

    There are a few paths to a solution for you on this issue. Our first priority with respect to Perl at the moment is to complete a port of Perl 5.24 using z/OS enhanced ASCII support but this could be a month or two away from complete and tested and you probably cannot wait for your project.

    Alternatively, we think this problem does not exist in our older port of Perl 5.16.2. If 5.16.2 works for you this is likely the fastest path with least effort. Would you like me to make this available to you?

    Lastly, do you have a support contract with us? This might enable me to re-assign resources and get someone to fix this in the 5.22 version.