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
 

 

DFSORT - Retrieve selective records from 2 input files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Thu Aug 06, 2015 4:12 pm    Post subject: DFSORT - Retrieve selective records from 2 input files
Reply with quote

Hi,

I have 2 input files. I need to copy 1-10 records from INFILE1 and 15-20 records from INFILE2 to OUTFILE. Now the OUTFILE will contain the 10 records of INFILE1 and 5 records of INFILE2.

I tried the below code.
Code:

//TOOL EXEC PGM=ICETOOL                               
//IN1 DD DSN=INFILE1,DISP=SHR                         
//IN2 DD DSN=INFILE2,DISP=SHR                         
//OUT1 DD DSN=OUTFILE,DISP=SHR                         
//TOOLMSG DD SYSOUT=*                                 
//DFSMSG DD SYSOUT=*                                   
//TOOLIN DD *                                         
  SUBSET FROM(IN1) TO(OUT1) INPUT KEEP RRN(1,10)       
  SUBSET FROM(IN2) TO(OUT1) INPUT KEEP RRN(11,5)       
/*                                                     


But the output file contains only the 5 records from the INFILE2.

Please let me know correct code.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Aug 06, 2015 4:53 pm    Post subject: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

Why is your disposition on OUT1 SHR when it should be MOD?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Aug 06, 2015 5:01 pm    Post subject: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

To have the same output dataset for two ICETOOL operations in the same step, you will need DISP=MOD, as superk has pointed out. You will also need your output dataset to be empty, or to not exist, before the step starts, else the DISP=MOD will add to existing data.
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Thu Aug 06, 2015 5:40 pm    Post subject: Re: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

Bill Woodger wrote:
To have the same output dataset for two ICETOOL operations in the same step, you will need DISP=MOD, as superk has pointed out. You will also need your output dataset to be empty, or to not exist, before the step starts, else the DISP=MOD will add to existing data.


I have the Empty OUTFILE and tried with DISP=MOD.

INFILE1 Contains
Code:

11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
11111111111111111111111111111
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222
22222222222222222222222222222


INFILE2 Contains
Code:

3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444
4444444444444444444444444444


After coding DISP=MOD OUTFILE contains
Code:

1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
1111111111111111111111111111
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
3333333333333333333333333333
4444444444444444444444444444


But this is not the excepted output. Not sure where i went wrong.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Aug 06, 2015 6:00 pm    Post subject: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

You need to read the manual more closely to understand what RRN is doing for you.

You think it is saying "record 11 and subsequent records until the total is five". What it is saying is "records from number 5 to number 11, inclusive".

RRN(11,5) and RRN(5,11) produce the same output. From the lowest number, to the highest number, inclusive.

You need 11,15 (or 15,11).
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Thu Aug 06, 2015 6:17 pm    Post subject: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

In your initial post, you said you wanted 15,20 from the second file. That is six records.
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Thu Aug 06, 2015 6:26 pm    Post subject: Re: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

Bill Woodger wrote:
You need to read the manual more closely to understand what RRN is doing for you.

You think it is saying "record 11 and subsequent records until the total is five". What it is saying is "records from number 5 to number 11, inclusive".

RRN(11,5) and RRN(5,11) produce the same output. From the lowest number, to the highest number, inclusive.

You need 11,15 (or 15,11).


Thanks Bill. Your explanation make sense.

Is there any simple way to handle my requirement.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Thu Aug 06, 2015 6:56 pm    Post subject: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

Quote:
Is there any simple way to handle my requirement.


just explain the meaningless remark ...

You were told to use DISP=MOD and it worked,
It was clarified Your MISwording about the number of records to be extracted

what else are You looking for ???
Back to top
View user's profile Send private message
narasimha_devi
Warnings : 1

New User


Joined: 10 Mar 2005
Posts: 26

PostPosted: Thu Aug 06, 2015 7:35 pm    Post subject: Re: Reply to: DFSORT - Retrieve selective records from 2 input files
Reply with quote

enrico-sorichetti wrote:
Quote:
Is there any simple way to handle my requirement.


just explain the meaningless remark ...

You were told to use DISP=MOD and it worked,
It was clarified Your MISwording about the number of records to be extracted

what else are You looking for ???


I overlooked Bill's last post that's why asked for alternate, thinking that my code was in accurate. It is working fine. Thanks Bill.

Sorry Enrico;
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm


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