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
 

 

Can we do this in sort??

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

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Tue May 09, 2006 7:01 pm    Post subject: Can we do this in sort??
Reply with quote

Hi,

I have two input files, file A and file B.
File A has records in following format

1100500000195616 1234
1100500000195616 9999
1100500000195616 0000
1100500000260444 1234
1100500000264225 1234
1100500000264999 7867

File B has records in following format

1100500000195616 4568
1100500000260444 4534
1100500000264225 7867
1100500000264999 7867

I need the output file in this format.
1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568

Can we do this in SORT ???

thanks
ap_mainframes
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: Tue May 09, 2006 8:36 pm    Post subject:
Reply with quote

You need to explain the rules you are using to go from input to output.

If your expected output was:

Code:

1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
1100500000260444 1234 4534
1100500000264225 1234 7867
1100500000264999 7867 7867


then I'd guess you're trying to add the second field from fileB to the end of fileA for records that match on the first field, and I could show you how to do that.

But since you show your expected output as:

Code:

1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568


I can't figure out what you're trying to do. What happened to the other records? What are the rules? Also, what is the RECFM and LRECL of your input files?
Back to top
View user's profile Send private message
ap_mainframes

Active User


Joined: 29 Dec 2005
Posts: 181
Location: Canada

PostPosted: Wed May 10, 2006 9:46 am    Post subject: Re: Can we do this in sort??
Reply with quote

Hi Frank,
Sorry for the incomplete " expected Output" . Actually the expected output is


1100500000195616 1234 4568
1100500000195616 9999 4568
1100500000195616 0000 4568
1100500000260444 1234 4534
1100500000264225 1234 7867
1100500000264999 7867 7867

Basically the rules are
1. To add the second field from fileB to the end of fileA for records that match on the first field.

2. Only those records should be written to output file where column A of file B that is 4568 is greater than column A of file A that is 1234.

Thanks
ap_mainframes
Back to top
View user's profile Send private message
IQofaGerbil

Active User


Joined: 05 May 2006
Posts: 183
Location: Scotland

PostPosted: Wed May 10, 2006 2:56 pm    Post subject: Re: Can we do this in sort??
Reply with quote

re rule 2

still trying to figure out how ;
4568 is greater than 9999 and
7867 is greater than 7867

maybe I have misubderstood the rule![/quote]
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: Wed May 10, 2006 8:58 pm    Post subject:
Reply with quote

ap,

I'm guessing you want to apply rule 2 after the records are joined, and that your final output should be:

Code:

100500000195616 1234 4568   
100500000195616 0000 4568   
100500000260444 1234 4534   
100500000264225 1234 7867   


Given that assumption, here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY FROM(IN2) TO(T1) USING(CTL1)
COPY FROM(IN1) TO(T1) USING(CTL2)
SPLICE FROM(T1) TO(OUT) ON(1,16,CH) -
  WITHALL WITH(1,21) USING(CTL3)
/*
//CTL1CNTL DD *
  OUTREC BUILD=(1,16,23:18,4)
/*
//CTL2CNTL DD *
  OUTREC OVERLAY=(26:X)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(23,4,ZD,GT,18,4,ZD)
/*
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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


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