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

Joinkey Sort Query


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
harinair_kn
Warnings : 2

New User


Joined: 27 Feb 2006
Posts: 16
Location: India

PostPosted: Fri Apr 08, 2011 12:37 pm
Reply with quote

Please find the joinkey sort below.
Code:

//STEP00A EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTJNF1 DD DSN=SKUROOL.INPUT1,DISP=SHR
//SORTJNF2 DD DSN=SKUROOL.INPUT2,DISP=SHR
//SORTOUT DD DSN=...
//SYSIN DD *
  JOINKEYS FILES=F1,FIELDS=(1,4,A)
  JOINKEYS FILES=F2,FIELDS=(1,4,A)
  REFORMAT FIELDS=(F1:1,4,F2:5,4)
  SORT FIELDS=COPY

Is there any possible REFORMAT option to get an output with sum of any fields?
Eg:
Input 1 - 1001 500
Input 2 - 1001 550
Required Output - 1001 1050
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Apr 08, 2011 5:23 pm
Reply with quote

Please state your requirement clearly...

If you just want to add values based on key, use of just SORT FIELDS\SUM FIELDS will suffice. join keys not required for this.

Please provide below information:

1: LRECL\RECFM of all input and output files
2: key field and other field positions\lengths
3: Sample input records
4: Expected output records for sample input shown.
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: Fri Apr 08, 2011 10:19 pm
Reply with quote

REFORMAT is NOT used for summing. REFORMAT is used for joining the records.

If you want to sum fields, you can use SORT/SUM, or OUTFIL with TRAILERx and TOT, for the records produced by REFORMAT. For example:

Code:

  JOINKEYS FILES=F1,FIELDS=(1,4,A)
  JOINKEYS FILES=F2,FIELDS=(1,4,A)
  REFORMAT FIELDS=(F1:1,4,F2:5,4)
  SORT FIELDS=COPY
  OUTFIL TRAILER1=(TOT=(1,4,ZD,TO=ZD),X,TOT=(5,4,ZD,TO=ZD))


You would have to give more details about what your trying to do before I could give you more specific help. Show an example of the records in each input file (relevant fields only) and what you expect for output. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files. If file1 can have duplicates within it, show that in your example. If file2 can have duplicates within it, show that in your example.
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 8
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts RC query -Time column CA Products 3
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
Search our Forums:

Back to Top