Using DFSORT for sorting, counting, writing in trailer



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

Using DFSORT for sorting, counting, writing in trailer

Postby yogeshvalhe » Sat Nov 20, 2010 2:29 am

Hello,

I have a requirement. I have two files having the data as below:
File 1 -
A 02------------------
A 02-----------------
A 01--------
A 03000000002
B 02------------------
B 02-----------------
B 02-----------------
B 01--------
B 03000000003
C 02------------------
C 02-----------------
C 02------------------
C 02-----------------
C 02------------------
C 02-----------------
C 01--------
C 03000000006
D 02------------------
D 01--------
D 03000000001

File 2 -

D 02------------------
D 01--------
D 03000000001
B 02------------------
B 02-----------------
B 02-----------------
B 01--------
B 03000000003
F 02------------------
F 01--------
F 03000000001


here 02 is detail record, 01 is header record, 03 is trailer record
I want use DFSORT / ICETOOL to sort and sum in such a way that -
1) Merge the two files in a single file
2) The header can be used from file 1, if particular record are absent (e.g. F) in file 1 then use the header from file 2
3) From the merged file, put the total count of records for each type (e.g.A, B, C, D, F etc.) in trailer

Please let me know, how this can be done.

Thank you in advance for your help.

Thanks,
Yogi
yogeshvalhe
 
Posts: 22
Joined: Wed Aug 18, 2010 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Using DFSORT for sorting, counting, writing in trailer

Postby dick scherrer » Sat Nov 20, 2010 2:50 am

Hello,

You need to show the output you want from the sampel input.

You also need to post the dsorg and lrecl of all files.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Using DFSORT for sorting, counting, writing in trailer

Postby yogeshvalhe » Sat Nov 20, 2010 2:58 am

sample output

A 02------------------
A 02-----------------
A 01--------
A 03000000002
B 02------------------
B 02-----------------
B 02-----------------
B 02------------------
B 02-----------------
B 02-----------------
B 01--------
B 03000000006
C 02------------------
C 02-----------------
C 02------------------
C 02-----------------
C 02------------------
C 02-----------------
C 01--------
C 03000000006
D 02------------------
D 02------------------
D 01--------
D 03000000002
F 02------------------
F 01--------
F 03000000001
yogeshvalhe
 
Posts: 22
Joined: Wed Aug 18, 2010 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Using DFSORT for sorting, counting, writing in trailer

Postby yogeshvalhe » Sat Nov 20, 2010 2:59 am

dsorg and lrecl is same for all three files.

GDG and lrecl=503
yogeshvalhe
 
Posts: 22
Joined: Wed Aug 18, 2010 3:32 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Using DFSORT for sorting, counting, writing in trailer

Postby Frank Yaeger » Sat Nov 20, 2010 4:09 am

Here's a DFSORT job that will do what I think you're asking for. I assumed the files have RECFM=FB.

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file1 (FB/505)
//       DD DSN=...  input file2 (FB/505)
//SORTOUT DD DSN=...  output file (FB/505)
//SYSIN DD *
  OPTION EQUALS
  OMIT COND=(3,2,ZD,EQ,3)
  INREC IFTHEN=(WHEN=(3,2,ZD,EQ,1),OVERLAY=(506:C'99999999')),
         IFTHEN=(WHEN=(3,2,ZD,EQ,2),OVERLAY=(506:SEQNUM,8,ZD))
  SORT FIELDS=(1,1,CH,A,506,8,ZD,A)
  SUM FIELDS=NONE
  OUTFIL REMOVECC,
    BUILD=(1,505),
    SECTIONS=(1,1,
      TRAILER3=(1,1,X,C'03',COUNT-1=(M11,LENGTH=9)))
/*
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: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post