This statement is supported only for backward compatibility. Use the DEFINE TEMP-TABLE statement, instead.
DEFINE NEW SHARED PRIVATEWORK-TABLE WORKFILE work-table-name NO-UNDOLIKE tablename VALIDATEFIELD field-name AS data-type LIKE fieldfield-optionsNEW SHARED WORK-TABLE WORKFILE work-table-nameSHARED WORK-TABLE WORKFILE work-table-namework-table-namePRIVATE WORK-TABLE WORKFILE
Note: work-table-nameWORK-TABLE WORKFILELIKE table-nameIf more than one connected database contains a table named table-name, you must qualify the table name with the database name. See the Record phrase description for more information.HELP options are inherited from the table-name. Validate options are inherited only if the VALIDATE keyword is used.FIELD field-nameAS data-typeFor more information on these data types, see the Data types reference entry.LIKE fieldIndicates the name of the variable, database field, temp-table field, or work table field whose characteristics you want to use for the work table field you are defining. If you name a variable with this option, you must have defined that variable earlier in the procedure. The work table field inherits the data type, extents, format, initial value, label, and column label of the field. You can override specific values by using the FORMAT, LABEL, INITIAL, DECIMALS, and EXTENT options. If you do not use these options, the field or variable takes on the characteristics of the variable or database field you name.
Note: The r-wrkfil.p procedure accumulates all balances by state and stores that information for display later. The procedure uses a work table to accomplish this task.The r-wrkfil.p procedure defines the work table showsales. The work table contains the three fields named region, state, and tot-sales. These fields have all the same characteristics (except labels) as the Customer.SalesRegion, Customer.State, and Customer.Balance fields, respectively.The first FOR EACH loop in the r-wrkfil.p procedure sorts Customers by state. Then it accumulates the balances for each Customer by state. When the procedure finds the last Customer in a state, it creates a showsales record for that state. The procedure assigns information to the fields in the showsales record. After looking at each Customer, the procedure continues to the next FOR EACH statement.The second FOR EACH statement in the r-wrkfil.p procedure uses the information stored in the showsales table. Because you treat a work table within a procedure the same way you treat a database table, you can perform the same work with the showsales table that you can with a database table.
You cannot define a SHARED or NEW SHARED work table in a class definition (.cls) file. If you do, ABL generates a compilation error.
See OpenEdge Getting Started: ABL Essentials for information on work tables and temp-tables.
© 2013 Progress Software Corporation and/or its subsidiaries or affiliates. |