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

Can we do this in sort??


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue May 09, 2006 8:36 pm
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
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
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 Developer


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

PostPosted: Wed May 10, 2006 8:58 pm
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 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 JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
No new posts how to calculate SUM for VB file usin... JCL & VSAM 1
Search our Forums:

Back to Top