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
 

 

Joinkey Sort Query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Joinkey Sort Query
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    Post subject:
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 Moderator


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

PostPosted: Fri Apr 08, 2011 10:19 pm    Post subject:
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


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