View previous topic :: View next topic
|
Author |
Message |
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
I'm trying to delete a particular record from a file. I know the record number. This record has junk data. But the file is too large to edit.
Eg. file has
Rec 1
Rec 2
Rec 3
Rec 4
Rec 5----------> has bad record
Rec 6
Rec 7
Rec 8
Assuming I want to skip the 5 th record which has junk so I cant use an OMIT COND either. So my steps:-
1. 1st sort step with SORT FIELDS=COPY,STOPAFT=4
2. 2nd sort step with SORT FIELDS=COPY,SKIPREC=5
3. 3rd sort to merge the output files of the above 2 sort steps.
Can anyone help me by advising a better or easier way to accomplish this task. May be we have any syntax to do it in one sort step?
Thanks |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT/ICETOOL job like the following to do what you asked for in one step/pass:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT DD DSN=... output file
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) REMOVE INPUT RRN(5)
|
|
|
Back to top |
|
|
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
Frank,
This might be the easy way but,
Our project dooes not have ICETOOL & I am also not familiar with using ICETOOL.
Can we have any alternative approach using sort or something? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
Our project dooes not have ICETOOL |
Since you posted in the DFSORT Forum, I assume you have DFSORT, which means you DO have dFSORT's ICETOOL. ICETOOL has been part of DFSORT since 1991!
Quote: |
I am also not familiar with using ICETOOL. |
Then you are missing out on a lot of DFSORT's functionality. It will be well worth your time to learn to use ICETOOL. I'd suggest reading through the ICETOOL section of "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples. You can access the book online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080
Complete information on DFSORT's ICETOOL is available at:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA50/7.0?DT=20100630155256 |
|
Back to top |
|
|
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
Really useful stuff, I need to learn a lot..I usually don't see anyone in my project using ICETOOOL so assumed like that.
Anyways I shall try the ICETOOL step you quoted. I have been hitting my head with fileaid since a long time and was not able to achieve my desired output. Then I tried using the 3 sort steps in my earlier post..got the results..But if the ICETOOL works then I will be more happier
Thanks again! |
|
Back to top |
|
|
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
actually it was to resolve a SOC7 abend..the junk record needed to be eliminated from the input file.. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
DFSORT's ICETOOL - try it - you'll like it! |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
why can't you use the omit parameter ? How do you determine the record number ?
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I assume he's identifying the "bad" record by "eyeball" rather than programmatically.
Apparently, there's nothing in the 5th record to identify it as such. It's just the fifth record. To use an OMIT statement, we would have to add a sequence number and then remove it. Using SUBSET is easier. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Frank,
I agree with you in dropping the 5th record using the SUBSET option it's easier, but even a junk field has a value in it.
Gerry |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Well, I guess the original poster would have to say if there was a way to programmatically identify the "bad" record by some value it contains.
The OP said:
Quote: |
actually it was to resolve a SOC7 abend..the junk record needed to be eliminated from the input file. |
So the question is whether the "junk record" can be identified by something it contains. I have no idea how the OP is identifying that record. I'll leave it to him to tell us. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Rijit,
you mentioned you had issues with FILEAID.
This should work
Code: |
//STEP0001 EXEC PGM=FILEAID
//DD01 DD DSN=input-file
//DD01O DD DSN=output-file
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
$$DD01 COPY OUT=4
$$DD01 SPACE IN=1
$$DD01 COPY
/*
|
Gerry |
|
Back to top |
|
|
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
Hi Gcicchet,
Actually The bad rrecord had total junk in it and it don't know what type of data it isis it packed binary or something. I just identified the record no which abended with soc7 using abendaid tool.
Even though the PS got opened in browse substituted mode..But I had seen the key and located the bad record immediately after that record manually. Then copied the file in test and removed that record and ran the job it went fine..The record no we can see by line no in browse mode.
Thats what Frank guesed rightly 'I assume he's identifying the "bad" record by "eyeball" rather than programmatically.'
Anyways Thank you for the File-aid stuff let me try this and see the results. |
|
Back to top |
|
|
Rijit
Active User
Joined: 15 Apr 2010 Posts: 168 Location: Pune
|
|
|
|
Actually the the bad record had data which was not at all matching with the copybook layout defined in the program..I dunno from where it came |
|
Back to top |
|
|
Hariharan Ramachandran
New User
Joined: 30 Nov 2010 Posts: 28 Location: Chennai, Tamilnadu,INDIA
|
|
|
|
Code: |
//*******************************************************************
//*THIS IS A SORT JCL TO DROP ALL THE INVALID VALUES FOR A PACKED
//*DECIMAL
//******************************************************************
//S001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=INPUT DATASET,DISP=SHR
//SORTOUT DD DSN=OUTPUT DATASET,
// DISP=XXXXXXXXX,SPACE=XXXXXXXXXX
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(64,2,PD,EQ,NUM)
/*
|
This job would help in removing all the invalid records in the Input Dataset. Just provide the coloumn number which includes the invalid records so that the job automatically removes all the records which has invalid values with respect to that position.
Regards,
#ari |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Actually The bad rrecord had total junk in it and it don't know what type of data it isis it packed binary or something. |
If you looked at the record using HEX ON, you could see the "junk" value in some position(s) and OMIT accordingly.
Personally, i'd prefer the method ari posted or the OMIT rather than skipping some particular record by record number in the file. . . |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Dick,
thanks for explaining it clearer then I was able to, that was the point I was trying to make.
Gerry |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Gerry,
Just multiple ways to raise the thought. . .
Have a great weekend!
d |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi Dick,
have a nice one too.
Gerry |
|
Back to top |
|
|
|