Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: SORT card for cutting records from input and writing it to o
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    Post subject: Reply to: SORT card for cutting records from input and writi
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    Post subject: Reply to: SORT card for cutting records from input and writi
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    Post subject: Reply to: SORT card for cutting records from input and writi
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

Site Director


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

PostPosted: Thu Jan 15, 2009 10:27 pm    Post subject:
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 Moderator


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

PostPosted: Thu Jan 15, 2009 10:34 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: SORT card for cutting records from input and writi
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

Site Director


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

PostPosted: Fri Jan 16, 2009 10:57 am    Post subject: Reply to: SORT card for cutting records from input and writi
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us