IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to skip a particular record and copy the rest


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 12:47 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 10, 2010 1:59 am
Reply with quote

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
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 2:08 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 10, 2010 2:19 am
Reply with quote

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
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 2:35 am
Reply with quote

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 icon_biggrin.gif

Thanks again!
Back to top
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 2:37 am
Reply with quote

actually it was to resolve a SOC7 abend..the junk record needed to be eliminated from the input file..
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 10, 2010 3:09 am
Reply with quote

DFSORT's ICETOOL - try it - you'll like it!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Dec 10, 2010 3:10 am
Reply with quote

Hi,

why can't you use the omit parameter ? How do you determine the record number ?

Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 10, 2010 3:25 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Dec 10, 2010 3:43 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Dec 10, 2010 3:57 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Fri Dec 10, 2010 4:46 am
Reply with quote

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
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 10:56 am
Reply with quote

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.' icon_biggrin.gif

Anyways Thank you for the File-aid stuff let me try this and see the results.
Back to top
View user's profile Send private message
Rijit

Active User


Joined: 15 Apr 2010
Posts: 168
Location: Pune

PostPosted: Fri Dec 10, 2010 11:00 am
Reply with quote

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 icon_eek.gif
Back to top
View user's profile Send private message
Hariharan Ramachandran

New User


Joined: 30 Nov 2010
Posts: 28
Location: Chennai, Tamilnadu,INDIA

PostPosted: Fri Dec 10, 2010 12:13 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 10, 2010 8:33 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat Dec 11, 2010 4:30 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Dec 11, 2010 8:25 am
Reply with quote

Hi Gerry,

Just multiple ways to raise the thought. . .

Have a great weekend!

d
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat Dec 11, 2010 12:40 pm
Reply with quote

Hi Dick,

have a nice one too.


Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts VB to VB copy - Full length reached SYNCSORT 8
Search our Forums:

Back to Top