IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only
Expand all | Collapse all

Why am I getting RNX1211 - I/O operation was applied to closed file...

  • 1.  Why am I getting RNX1211 - I/O operation was applied to closed file...

    Posted Tue August 24, 2021 12:51 PM

    I wrote a quick test program to lock a record. When I run it the first time, no problems. When I run it a second time, I get RNX1211 - I/O operation was applied to closed file PFDLRREPS. Why?

    **free

    /if defined(*crtRPGBND)

    ctl-opt actGrp(*new) dftActGrp(*no);

    /endIf

    ctl-opt main(entry) option(*noDebugIO);

    dcl-f pfDlrReps keyed usage(*update);

    dcl-proc entry;

    dcl-pi entry extPgm('T_REP_LOCK');

    dealer char(6);

    end-Pi;

    dcl-s response char(1);

    chain dealer dealerReps;

    if %found();

    drAuth = 'lock';

    dsply 'Rec locked until you press enter' '' response;

    update dealerReps;

    endIf;

    close pfDlrReps;

    end-Proc;





    #Support
    #IBMi
    #SupportMigration


  • 2.  RE: Why am I getting RNX1211 - I/O operation was applied to closed file...
    Best Answer

    Posted Thu August 26, 2021 03:02 AM

    Found it!!! Look back at the code on the second line. I keyed *crtRPGBND instead of *crtBndRPG. Because of my typo the file was opened/closed in the default activation group. Works like a charm in a *new activation group :)





    #SupportMigration
    #Support
    #IBMi