Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 query to fetch record which has only ... maxsubrat DB2 2 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 4 Wed Nov 22, 2017 10:23 pm
No new posts Native SQL Query kishpra DB2 1 Wed Nov 22, 2017 8:38 pm
No new posts Query on IEFBR14 with GDG Ashishpanpaliya JCL & VSAM 4 Tue Nov 07, 2017 8:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us