View previous topic :: View next topic
|
Author |
Message |
Syed Mudassir Uddin
New User
Joined: 15 Jan 2009 Posts: 8 Location: Hyderabad
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
Syed Mudassir Uddin
New User
Joined: 15 Jan 2009 Posts: 8 Location: Hyderabad
|
|
|
|
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 |
|
|
hikaps14
Active User
Joined: 02 Sep 2005 Posts: 189 Location: Noida
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
I would certainly create a backup of INPUT before doing this. |
|
Back to top |
|
|
Syed Mudassir Uddin
New User
Joined: 15 Jan 2009 Posts: 8 Location: Hyderabad
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - good luck
d |
|
Back to top |
|
|
|