How to delete particular row in the data set
How to delete particular row in the data set
Hi,
I need to delete particular row in the data set
Ex
Xxxx A
Xxxx b
Xxxx c
I need to delete the row with record xxxx b and the changes need to remain in the same data set.i need a program to do this process can any one help me pls?
Thanks
Deva
I need to delete particular row in the data set
Ex
Xxxx A
Xxxx b
Xxxx c
I need to delete the row with record xxxx b and the changes need to remain in the same data set.i need a program to do this process can any one help me pls?
Thanks
Deva
Last edited by Anuj Dhawan on Fri Jul 18, 2014 9:25 pm, edited 1 time in total.
Reason: Moved the topic from "Polls and Ideas." It does not belong there.
Reason: Moved the topic from "Polls and Ideas." It does not belong there.
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: How to delete particular row in the data set
Terminology note: data bases have rows. data sets have records. they are not the same.
Assuming you are talking about a data set and not a data base, the first question is what kind of data set? If the data set is a VSAM KSDS then you can delete the record by deleting the key of that record. If the data set is sequential, you MUST copy the data set to another data set, omitting the record you do not want copied. You can then optionally copy the output back to the original data set.
Assuming you are talking about a data set and not a data base, the first question is what kind of data set? If the data set is a VSAM KSDS then you can delete the record by deleting the key of that record. If the data set is sequential, you MUST copy the data set to another data set, omitting the record you do not want copied. You can then optionally copy the output back to the original data set.
Re: How to delete particular row in the data set
let me come up with example of what my situation....
for example:
dataset 1 contain following records
abcd 1
efgh 2
ijkl 1
mnop 2
dataset 2
efgh 2
i need to compare the two dataset records if 2nd dataset value is find in the Ist dataset records then it
need to compare with next record if the next record contain value as 1 in the 6th column then goes to next
and the next record contain 2 in 6th column then that record need to be removed.
if this comparison possible by if else or any other methods.
for example:
dataset 1 contain following records
abcd 1
efgh 2
ijkl 1
mnop 2
dataset 2
efgh 2
i need to compare the two dataset records if 2nd dataset value is find in the Ist dataset records then it
need to compare with next record if the next record contain value as 1 in the 6th column then goes to next
and the next record contain 2 in 6th column then that record need to be removed.
if this comparison possible by if else or any other methods.
- Anuj Dhawan
- Founder
- Posts: 2803
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: How to delete particular row in the data set
When you say "remove" (delete?)-- do you really mean to remove from the input file or you're okay if you write the "compared results" to another output file?DEVAPRIYA wrote:i need to compare the two dataset records if 2nd dataset value is find in the Ist dataset records then it
need to compare with next record if the next record contain value as 1 in the 6th column then goes to next
and the next record contain 2 in 6th column then that record need to be removed.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Re: How to delete particular row in the data set
yes, i need to delete the particular record mnop 2 from dataset 1.
Re: How to delete particular row in the data set
i like to add one more detail if dataset 1 contain another record
abcd 1
efgh 2
ijkl 1
mnop 2
qrst 2
only that mnop 2 need to be deleted next record should not be deleted.
abcd 1
efgh 2
ijkl 1
mnop 2
qrst 2
only that mnop 2 need to be deleted next record should not be deleted.
- Anuj Dhawan
- Founder
- Posts: 2803
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: How to delete particular row in the data set
If it is so -- STOP -- and think around the first post from Robert, where he said:DEVAPRIYA wrote:yes, i need to delete the particular record mnop 2 from dataset 1.
Remember couple of things before you proceed for your solution:the first question is what kind of data set? If the data set is a VSAM KSDS then you can delete the record by deleting the key of that record. If the data set is sequential, you MUST copy the data set to another data set, omitting the record you do not want copied. You can then optionally copy the output back to the original data set.
- 1. You CAN NOT delete the records from a sequential file. And keeping the inference from your posts in mind, so far -- you seem to talk about sequential files only and if that's true -- you are picking up a wrong choice to do what you want to do.
This is not the way this works on zOS -- as I've indicated earlier and Robert has also said that if you want to remove (delete) records from a sequential data-set (QSAM) and you're thinking to use DELETE command (as an appropriate one) - you can not issue DELETE some-record for a QSAM, the system does not accept this (Why? That's the rule). One of the alternative is what Robert has said and I think that's most practical in your situation.
2. If your files are VSAM (KSDS), you can issue DELETE however you need to tell us what kind of VSAM it is - as you can not "delete" records from ESDS too but there are ways to mark them delete.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute