PL/I

PL/I

PL/I

 View Only
  • 1.  Internal Array within a PL/1 program reaching limit

    Posted Fri November 21, 2014 02:22 PM

    Hello -

    I have a PL/1 program that contains an internal array.  The array size is currently set to 1,250,000, at 800 bytes per array record.

    I need to increase this array size to accomodate business needs.

    DCL 01  NITI_ARRAY (1250000) AUTOMATIC,    
            ++INCLUDE DSDNITI;         (DSDNITI include member is 800 bytes long).

    But when I increase the array size to 1,500,000, and try to compile the program, it fails.

    I get this error:   "SEVERE ERROR IBM5141: Automatic area for DSD4124 is too large."

    I know i can get around this by redesigning the program to not have an internal array.  But I would like to avoid that if possible.

    I have talked with Tech teams and searched online for answers/examples but can't find anything that works.

    Does anyone know how to get around this problem , by just making changes to the program itself or compiling it differently?

    Thanks for your help!

    Nancy

     

    NJAH


  • 2.  Re: Internal Array within a PL/1 program reaching limit

    Posted Fri November 21, 2014 02:23 PM

    I forgot to mention that 'DSD4124' is the program name that contains the array.

    NJAH


  • 3.  Re: Internal Array within a PL/1 program reaching limit

    Posted Tue November 25, 2014 05:16 AM

    hi,

    i have no specific knowledge about that, but the documentation 

    "Explanation:

    Automatic data resides in the stack; the stack size is limited by the target machine addressabilty.
    Avoid large structures and large arrays as local variables; try using dynamically allocated data. Alternatively, try to break down the procedure into several smaller procedures."

    doesn't sound very promising (and a hard stack size limit sounds absolutely reasonable).
    changing the array from static to dynamically allocated shall be possible without completely breaking up your program.

    just my 0.02€,

    br johann

     

    woecki


  • 4.  Re: Internal Array within a PL/1 program reaching limit

    Posted Tue November 25, 2014 10:39 AM

    Hello woecki, thanks for replying!

    I have searched for examples on how to allocate this array DYNAMICALLY, but cannot find information on it anywhere.  I have checked PL/1 books, as well as online, but no luck yet.  Would you have any information on how to do that?

    Thanks for your input!

    Nancy 

    NJAH


  • 5.  Re: Internal Array within a PL/1 program reaching limit

    Posted Tue November 25, 2014 11:21 AM

    hi, i think

    dcl 1 foo(1 000 000) controlled,         2 bar char(800);allocate foo;free foo;

    shall work (but i have no compiler at hand at the moment, so there might be a typo).

    "controlled" tells the compiler to put the var to heap, "allocate" does the allocation. don't forget to "free" :-).

    the limit for heap allocation might be environment specific, hopefully your environment provides the space you need.

    br johann

    woecki


  • 6.  Re: Internal Array within a PL/1 program reaching limit

    Posted Tue November 25, 2014 03:00 PM

    NJAH,

    Do the math, 1,500,000 * 800 = 1,200,000,000 bytes (a little less than 1.2G). At that size you may find your program won't run on some machines with a lot of system memory defined (eg. CSA and other such requirements), unless of course you go to AMODE(64), but that's only supported by C/C++ at this point in time.

    You may need to consider a data redesign... :-(

    Bernie

    PS. I'm suspecting the maximum stack frame size is 0x40000000 bytes, but the limits section of the Language Reference is silent on the topic.

    brataj


  • 7.  Re: Internal Array within a PL/I program reaching limit

    Posted Tue December 02, 2014 10:20 AM

    Do you have other automatic arrays or large structures in the same block?

    If so, how large are they?

    Robin400


  • 8.  Re: Internal Array within a PL/1 program reaching limit

    Posted Tue December 02, 2014 11:05 AM

    Thank you all for replying!  I appreciate the help!

    Woecki, I modified my code to define it as you suggested:

    DCL 01  NITE_ARRAY (1500000) CONTROLLED,                             
            ++INCLUDE DSDNITE;              /* 800 bytes long*/                             
    ALLOCATE NITE_ARRAY;                  /* DYNAMICALLY ALLOCATE SPACE FOR THE ARRAY */
    FREE NITE_ARRAY;                            /* FREE THE ARRAY SPACE AFTER USE           */

    The program compiled fine the way I had it with a size of 1,250,000, but not at 1,500,000.

    With the changes you suggested, I can now get it to compile with a size of 1,500,000.  However, when I run the job, it abends on the statement that initializes the array, regardless of whether this initialize statement is performed in the root module or the called module that loads the array with records from a file:

     NITE_ARRAY (*)             = '';
     

    The Error message that is logged is:

    THE SYSTEM COMPLETION CODE OF 0C4 IS ISSUED WHEN THE PROGRAM ATTEMPTS TO
    USE STORAGE THAT IS NOT ACCESSIBLE.                                    
     

    Brataj, I agree, it is a large amount of space I am requesting.  The business keeps adding more and more invoices to this system, and it was not designed to accomodate this many records.  If there is a way around this issue by doing some special type of allocating, and being able to avoid an extensive redesign, that would be nice!

    Robin400, Yes I do have one other array defined in the same program, but it is much, much smaller:  (2000 records at 166 bytes each).

     

    NJAH


  • 9.  Re: Internal Array within a PL/1 program reaching limit

    Posted Wed December 03, 2014 02:42 AM

    hi njaj,

    i compiled & ran your sample and got the same result. sorry for guiding you into a dead end.

    i have no further ideas (tried several but all failed).

    br woecki

     

     

    woecki


  • 10.  Re: Internal Array within a PL/1 program reaching limit

    Posted Wed December 03, 2014 06:40 AM

    Sounds like something is being overwritten.

    Have you run this code with SUBSCRIPTRANGE enabled?

    Robin400