mix files by groups



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

mix files by groups

Postby javivi » Thu Jun 30, 2011 4:10 pm

Hi I have the next problem to generate a file from 2 files:

File1, 05 lrecl:
00100
00233
00300
...
...

file2, with only 03 records with 21 lrecl:
FROM 001EUR TO 100EUR
FROM 101EUR TO 200EUR
MORE THANT 200EUR

Then I need to create a file as:

00100 FROM 001EUR TO 100EUR
00100 FROM 101EUR TO 200EUR
00100 MORE THANT 200EUR
00233 FROM 001EUR TO 100EUR
00233 FROM 101EUR TO 200EUR
00233 MORE THANT 200EUR
00300 FROM 001EUR TO 100EUR
00300 FROM 101EUR TO 200EUR
00300 MORE THANT 200EUR
...
...

It is possible with asort?.

Thanks from Spain.
javivi
 
Posts: 47
Joined: Fri Jan 21, 2011 2:53 pm
Has thanked: 0 time
Been thanked: 0 time

Re: mix files by groups

 

Re: mix files by groups

Postby Frank Yaeger » Thu Jun 30, 2011 9:08 pm

Here's a DFSORT job that will do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/5)
//IN2 DD DSN=... input file2 (FB/21)
//SORTOUT DD DSN=...  output file (FB/27)
//SYSIN DD *
  JOINKEYS F1=IN1,FIELDS=(1,1,A),SORTED,NOSEQCK
  JOINKEYS F2=IN2,FIELDS=(1,1,A),SORTED,NOSEQCK
  REFORMAT FIELDS=(F1:2,6,F2:2,21)
  OPTION COPY
/*
//JNF1CNTL DD *
  INREC BUILD=(X,1,5,X)
/*
//JNF2CNTL DD *
  INREC BUILD=(X,1,21)
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: mix files by groups

Postby javivi » Fri Jul 01, 2011 12:22 pm

Thanks Frank.

It was so easy.... but I could not think how....
javivi
 
Posts: 47
Joined: Fri Jan 21, 2011 2:53 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post