User Tools

Site Tools


release_release_a_held_record_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== RELEASE (release a held record) ====== Previous pageReturn to chapter overviewNext page

RELEASE( entity )

blk2blue.jpg

RELEASE Releases the held record(s).
entity The label of a FILE or VIEW declaration.

The RELEASE statement releases a record previously held by the HOLD procedure. It will not release a record held by another user in a multi-user environment. If the record is not held, or is held by another user, RELEASE is ignored.

Example:

ViewOrder VIEW(Customer)  !Declare VIEW structure

          PROJECT(Cus:AcctNumber,Cus:Name)

          JOIN(Hea:AcctKey,Cus:AcctNumber) !Join Header file

           PROJECT(Hea:OrderNumber)

           JOIN(Dtl:OrderKey,Hea:OrderNumber) !Join Detail file

            PROJECT(Det:Item,Det:Quantity)

            JOIN(Pro:ItemKey,Dtl:Item) !Join Product file

             PROJECT(Pro:Description,Pro:Price)

            END

           END

          END

         END

CODE

OPEN(Customer,22h)

OPEN(Header,22h)

OPEN(Detail,22h)

OPEN(Product,22h)

SET(Cus:AcctKey)

OPEN(ViewOrder)

LOOP                           !Process records Loop

 LOOP                          !Loop to avoid “deadly embrace”

  HOLD(ViewOrder,1)            !Arm Hold on view, try for 1 second

  NEXT(ViewOrder)              !Get and hold the record

  IF ERRORCODE() = 43          !If someone else has it

   CYCLE                       !and try again

  ELSE

   BREAK                       !Break if not held

  END  

 END

 IF ERRORCODE() THEN BREAK END !Check for end of file

  !Process the records

RELEASE(ViewOrder)            !release held records

END

See Also:

HOLD

PUT

release_release_a_held_record_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1