Data area *LIBL/INSRLIST is not allocated for output.

940 pts.
Tags:
RPG
RPGLE
V5R4
The following is a snippet of the code. I get an error on the OUT op code as in the title.

 * Next List Number                                   D                 DS                                  D Get_Next_List                  6S 0 DtaAra(INSRLIST)

//  Create Header record              In *Lock Get_Next_List;         //  Ge                                       DoU Done  = @True;                    Chain(E) Get_Next_List INSRL100;      If %Found;                     // Inc    Get_Next_List = Get_Next_List +1;        If Get_Next_List = 999999;               Get_Next_List =      1;            EndIf;                             Iter;                              EndIf;                                If NOT %Found;                           SHListNo      = Get_Next_List;        Get_Next_List = Get_Next_List  +1;    Out      Get_Next_List;      //  Up EndIf;                               

Thanks, Phil



Software/Hardware used:
V5R4
ASKED: February 25, 2010  9:31 PM
UPDATED: February 26, 2010  2:17 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

<pre>
* Next List Number
D DS
D Get_Next_List 6S 0 DtaAra(INSRLIST)

// Create Header record
In *Lock Get_Next_List; // Ge

DoU Done = @True;
Chain(E) Get_Next_List INSRL100;
If %Found; // Inc
Get_Next_List = Get_Next_List +1;
If Get_Next_List = 999999;
Get_Next_List = 1;
EndIf;
Iter;
EndIf;
If NOT %Found;
SHListNo = Get_Next_List;
Get_Next_List = Get_Next_List +1;
Out Get_Next_List; // Up
EndIf;
</pre>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • philpl1jb
    Phil Nothing seems wrong in the code you've shown Eventually it reaches the Enddo looping back to the do until And if DoU Done = @True; this isn't true it finds another number and tries to out to the dataarea. But the second time the dataarea is no longer locked -- the out unlocks it and the error occurs. The other Phil
    48,595 pointsBadges:
    report
  • philpl1jb
    // finally a good business use for recursion -- this still needs work -- if all numbers // are used it never ends In *Lock Get_Next_List; // if getNextVal(Get_Next_List ); SHListNo = Get_Next_List; Get_Next_List = Get_Next_List +1; Out Get_Next_List; ------------------------------------------ P getNextVal B D getNextVal PI N D Get_Next_List like (SHListNo ) /free Get_Next_List = Get_Next_List +1; If Get_Next_List = 999999; Get_Next_List = 1; EndIf; Chain(E) Get_Next_List INSRL100; if found%(INSRL100); return getNextVal(Get_Next_List ); else return *on; endif; /end-free P getNextVal B
    48,595 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following