Edit a new record in a dataset using REXX



IBM's Command List programming language & Restructured Extended Executor

Edit a new record in a dataset using REXX

Postby mbisa » Thu Nov 15, 2007 1:16 pm

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.
mbisa
 
Posts: 7
Joined: Thu Nov 15, 2007 11:57 am
Has thanked: 0 time
Been thanked: 0 time

Re: Edit a new record in a dataset using REXX

Postby MrSpock » Thu Nov 15, 2007 8:24 pm

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.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: Edit a new record in a dataset using REXX

Postby mbisa » Mon Nov 19, 2007 7:57 am

thanks a lot mr.spock.
mbisa
 
Posts: 7
Joined: Thu Nov 15, 2007 11:57 am
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post