PM98899: __IOLBF LINE BUFFERING IN AN ENHANCED ASCII PROGRAM DOES NOT RESULT IN THE BUFFER BEING FLUSHED AT EACH NEWLINE

A fix is available

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • #include <stdio.h>
    #include <time.h>
    The following small C program compiled in Enhanced ASCII mode
    produces output that immediately follows the program source:-
    -----
    #include <unistd.h>
    
    int main( void ) {
        int I;
        time_t clock;
    
    if ( 1 ) {
     if ( setvbuf( stdout, NULL, _IOLBF, 36 ) ) perror( "stdout");
     if ( setvbuf( stderr, NULL, _IOLBF, 36 ) ) perror( "stderr");
         }
        for ( I = 0; I<5; I++ ) {
            fprintf( stdout, "Record %2d to stdout \t%s\n", I,
                ctime( ( time( &clock ), &clock ) ) );
            sleep( 1 );
            fprintf( stderr, "Record %2d to stderr \t%s\n", I,
                ctime( ( time( &clock ), &clock ) ) );
            sleep( 1 ); }
    
        return( 0 ); }
    ---
    Record  0 to stderr     Mon Aug 19 12:20:51 2013
    Record  1 to stderr     Mon Aug 19 12:20:53 2013
    Record  2 to stderr     Mon Aug 19 12:20:55 2013
    Record  3 to stderr     Mon Aug 19 12:20:57 2013
    Record  4 to stderr     Mon Aug 19 12:20:59 2013
    Record  0 to stdout     Mon Aug 19 12:20:50 2013
    Record  1 to stdout     Mon Aug 19 12:20:52 2013
    Record  2 to stdout     Mon Aug 19 12:20:54 2013
    Record  3 to stdout     Mon Aug 19 12:20:56 2013
    
    The above indicates the buffer is not being flushed at each
    newline. The program works correctly in EBCDIC mode and inorder
    to obtain comparable output for the ASCII program, the \n in the
    source needed to be changed to \025
    

Local fix

  • use fflush() as a bypass
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: Users of z/OS C/C++ Enhanced ASCII I/O       *
    *                 applications that also use any of the        *
    *                 printf family of functions as well as line   *
    *                 buffering mode.                              *
    ****************************************************************
    * PROBLEM DESCRIPTION: For Enhanced ASCII applications that    *
    *                      also use line buffering mode (__IOLBF), *
    *                      the new-line character in a printf()    *
    *                      may not cause the I/O buffer to be      *
    *                      flushed properly.                       *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    See problem description.
    

Problem conclusion

  • The code was corrected to fix the problem.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PM98899

  • Reported component name

    LE C LIBRARY

  • Reported component ID

    568819805

  • Reported release

    780

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-10-11

  • Closed date

    2014-01-10

  • Last modified date

    2014-02-05

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    UI14146 UI14147 UI14148

Modules/Macros

  •    CELHBFMT CELHDFMA CELHDFME CELHDFMT CELHDFM2
    CELHFPRT CELHPRTA CELHPRTF CELHSPRT CELHSPTA CELHVFPR CELHVPRT
    CELHVPR2 CELHVSPR CELHXFMT CELJDFME CELJDFMT CELJDFM2 CELJFPRT
    CELJPRTF CELJSPRT CELJVFPR CELJVPRT CELJVPR2 CELJVSPR CELJXFMT
    CELQDFME CELQDFMT CELQDFM2 CELQFPRT CELQPRTF CELQSPRT CELQVFPR
    CELQVPRT CELQVPR2 CELQVSPR CELQXFMT CELZDFME CELZDFMT CELZDFM2
    CELZFPRT CELZPRTF CELZSPRT CELZVFPR CELZVPRT CELZVPR2 CELZVSPR
    CELZXFMT EDC4001B EDC40096 EDC401A5 EDC401A6 EDC401A7 EDC4014F
    EDC40173 EDC403BF EDC403C0 EDC4045D EDC4045E EDC40473 EDC40474
    EDC40475 EDC40476
    

Fix information

  • Fixed component name

    LE C LIBRARY

  • Fixed component ID

    568819805

Applicable component levels

  • R770 PSY UI14146

       UP14/01/22 P F401

  • R780 PSY UI14147

       UP14/01/22 P F401

  • R790 PSY UI14148

       UP14/01/22 P F401

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.



Rate this page:

(0 users)Average rating

Document information


More support for:

z/OS XL C/C++
Runtime

Software version:

780

Operating system(s):

MVS, z/OS

Reference #:

PM98899

Modified date:

2014-02-05

Translate my page

Machine Translation

Content navigation