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

SORT card for cutting records from input and writing it to o


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

New User


Joined: 15 Jan 2009
Posts: 8
Location: Hyderabad

PostPosted: Thu Jan 15, 2009 7:49 pm
Reply with quote

Hi All,

I have a requirement to cut few records from input file based on some condition and write it to output.
Those specific records should not be present again in the input file.

We have sort parameters to Include and omit. But is there any parameter to cut the records from input and write it to output.

If there is any sort parameter could you please share it with me.

Thanks a prior.

Thanks and Regards,
Syed
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jan 15, 2009 8:07 pm
Reply with quote

From your statement :
Quote:
I have a requirement to cut few records from input file based on some condition and write it to output.
Those specific records should not be present again in the input file.


I interpret "CUT" means you want to skip records.

We usually use OMIT command to skip any set of records meeting a particualr criteria.

It would be better if you post some sample set of I/P and required O/P records.

Thanks,
-Kapil.
Back to top
View user's profile Send private message
Syed Mudassir Uddin

New User


Joined: 15 Jan 2009
Posts: 8
Location: Hyderabad

PostPosted: Thu Jan 15, 2009 8:42 pm
Reply with quote

If we use OMIT command then those records will be skipped from getting copied and rest of the records will be written to output file.

My requirement is to copy a set of records from input file and write it to output file and those records should get deleted from input file.

For example if my input file is like below:

123 ABCDEF RTDFGHTREE
324 GFHTRE OYTURUYIGE
456 HGTRYU TRUERTRFVB

And my requirement is to copy the record whose first three characters are 324. Then, my output file should have that perticular record.

324 GFHTRE OYTURUYIGE

And input should not have that record. My input file should be like below.

123 ABCDEF RTDFGHTREE
456 HGTRYU TRUERTRFVB

Is it possible to accomplish this task in one sort step?

Thanks and Regrades,
Syed
Back to top
View user's profile Send private message
hikaps14

Active User


Joined: 02 Sep 2005
Posts: 189
Location: Noida

PostPosted: Thu Jan 15, 2009 10:26 pm
Reply with quote

Hi,

I don't know if you can directly access and delete records in the I/P file using sort.

I rather have a logical solution for your scenario :
Quote:

My requirement is to copy a set of records from input file and write it to output file and those records should get deleted from input file.


I would suggest you creating 2 O/P files instead of 1 in the same step.
1st file would have those extracted set of records obtained via INCLUDE condition. Your 2nd file would have all the I/P records except those present in 1st file, this would be achieved via OMIT condition.

Note : condition in both INCLUDE & OMIT will be same.

The only thing is your 2nd file name should be used as new I/P for further use. The new file name seems to the only problem with this approach.

Thanks,
-Kapil.
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: Thu Jan 15, 2009 10:27 pm
Reply with quote

Hello,

Create 2 output files. You will not delete records from the input file.

Actually (imho) you would not want to even if you could - there would be no way to re-run if some problem was found that required a re-run.
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: Thu Jan 15, 2009 10:34 pm
Reply with quote

You cannot change the input file directly that way. You have to write two output files and then copy one of them back to the input file. You can do that in one step with a DFSORT/ICETOOL job like this:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN DD DSN=INPUT,DISP=SHR
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=OUT,...
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(IN)
/*
//CTL1CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(1,3,CH,EQ,C'324')
  OUTFIL FNAMES=T1,SAVE
/*
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Jan 15, 2009 11:56 pm
Reply with quote

I would certainly create a backup of INPUT before doing this.
Back to top
View user's profile Send private message
Syed Mudassir Uddin

New User


Joined: 15 Jan 2009
Posts: 8
Location: Hyderabad

PostPosted: Fri Jan 16, 2009 10:14 am
Reply with quote

Thank you all.

I will go ahead with creating two output files so that incase of any failure I will have a backup of data.

-Syed
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 Jan 16, 2009 10:57 am
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top