Page 1 of 1

Edit a new record in a dataset using REXX

PostPosted: Thu Nov 15, 2007 1:16 pm
by mbisa
hi, i would like to know how can i insert, delete or edit a new record in a dataset using REXX.
first, the user will see the content of all the records in the table. Then the user will be able to insert, delete or update the records in the table. And also is there a way , the REXX program remember which line or record did the user insert, delete or update.
thanks.

Re: Edit a new record in a dataset using REXX

PostPosted: Thu Nov 15, 2007 8:24 pm
by MrSpock
mbisa wrote:i would like to know how can i insert, delete or edit a new record in a dataset using REXX.


For the first two, you use the normal sequential dataset processing guidelines. To insert a record, you'll have to:

a. read the input dataset one record at a time. Write each record to a different output dataset. Write the inserted record where appropriate. Then, continue to read and write until you reach EOF. Then, copy the entire contents of the new output dataset to the old input dataset.

b. allocate the dataset for DISP=MOD processing. You can then insert new records at the end of the dataset.

To delete a record, do the same as "a." above, except you must skip writing the deleted record to the output dataset.

To update an existing record in-place, you can use the DISKRU (Read with Update) and DISKW functions of EXECIO.

mbisa wrote:is there a way , the REXX program remember which line or record did the user insert, delete or update.


Only if you provide some sort of tracking mechanism in your code.

Re: Edit a new record in a dataset using REXX

PostPosted: Mon Nov 19, 2007 7:57 am
by mbisa
thanks a lot mr.spock.