How to find the number of records altered using DFSORT

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

How to find the number of records altered using DFSORT

Hi all,

I have one flat file of LRECL 80 with the following records.

AAAAAAAAAAAAAAAAA72BBBBBB.....
AAAAAABBBBBCCCCCCC76BBBBBB....
AAAAAACCCCCCCCCCC72CCBBBB....
AAAAAACCCCCCBBCCC72BBBBBB....
BBBCCCCCCCCCCCCCC76BBBBBB....

The characters 72 and 76 appear in the input file at the same position say 18. I would like to change 72 to 63 and 76 to 66 using a SORT card.
After changing I would like to know how many 72 got changed to 63 and how many 76 got changed to 66 in the SORT step itself.
Is it possible to find the count?

Thanks
Prasanna G

Prasanna G

Posts: 68
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to find the number of records altered using DFSORT

Well, it would have been helpful if you'd shown your expected output, but assuming you just want the counts on a separate line at the end, you can use a DFSORT job like the following:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AAAAAAAAAAAAAAAAA72BBBBBB.....
AAAAAABBBBBCCCCCC76BBBBBB....
AAAAAACCCCCCCCCCC72CCBBBB....
AAAAAACCCCCCBBCCC72BBBBBB....
BBBCCCCCCCCCCCCCC76BBBBBB....
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'00')),
IFTHEN=(WHEN=(18,2,CH,EQ,C'72'),
OVERLAY=(18:C'63',81:C'1')),
IFTHEN=(WHEN=(18,2,CH,EQ,C'76'),
OVERLAY=(18:C'66',82:C'1'))
OUTFIL REMOVECC,BUILD=(1,80),
TRAILER1=(/,'72 TO 63 COUNT = ',TOT=(81,1,ZD,M10,LENGTH=5),
', 76 TO 66 COUNT = ',TOT=(82,1,ZD,M10,LENGTH=5))
/*
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

Frank Yaeger
Global moderator

Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: How to find the number of records altered using DFSORT

Thanks for a quick reply Frank.. I should have been more clear in my previous post.
As this is my first post, I was not aware the way of asking questions.
Is it possible to generate a report of the below format using SORT?

PROGRAM-R01 XYZ COMPANY PAGE: 1
RUN DATE: 10/26/06 HARTFORD STANDARD REPORT
RUN TIME: 09:12:41 EDITED FILE TRANSACTION CONVERSION
CONTROL REPORT

3.0 TOTAL RECORDS 72 TRNS CODE CONVERTED TO 63: 2
4.0 TOTAL RECORDS 76 TRNS CODE CONVERTED TO 66: 3
5.0 TOTAL UNPROCESSED RECORDS: 90

*** END OF REPORT ***

Prasanna G

Posts: 68
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to find the number of records altered using DFSORT

Well, yes, you can do that with OUTFIL. But if you want me to show you how, you need to tell me where the various information comes from. What would be hardcoded (Program name, Company name, etc)?. What does the header record count represent? I don't see any header records in your example input.

Please show me a better example of the records in your input file (with headers) and what you expect for output and explain the rules for getting from input to output.
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

Frank Yaeger
Global moderator

Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: How to find the number of records altered using DFSORT

Yes Frank.
This is how the exact input file will look like.

H1036799    ANDERSON    TIM     119220101 172SH06302010121561  20101215
H1036800    ANDERSON    JIM     119220101 176SH06302010121561  20101215

Except the Time, Date and Counter values all others are constants in the control report. The rule for getting them in the output file is copy all the records from the input file with transaction codes 72 converted to 63 and 76 to 66 and all other trans codes left untouched.

Please let me know if my requirement is not clear.

Prasanna G

Posts: 68
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to find the number of records altered using DFSORT

That doesn't help much. I wanted to see a good example of the input records (e.g. more than one header, records to be processed, records not to be processed), and the expected output for those input records so I could tell what you really wanted. Please show such an example of input and output.

Also:

Is there only one header record or can there be more than one?

Is a header record identified by 'HEADER' in positions 7-12 or by something else (what)?

Do the '72' and '76' appear in positions 44-45 or somewhere else (where)?
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

Frank Yaeger
Global moderator

Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: How to find the number of records altered using DFSORT

1. The input will have only one header.
3. The transaction codes appear only in position 44-45

Input File:
H1036799    ANDERSON    TIM     119220101 172SH06302010121561  20101215
H1036800    ANDERSON    JIM     119220101 176SH06302010121561  20101215
H1036801    TAMMY       TIM     119220101 161SH06302010121561  20101215
H1036802    RINONLD     BOB     119220101 176SH06302010121561  20101215
H1036803    PETER       PRKER   119220101 172SH06302010121561  20101215
H1036804    DONALD      MC      119220101 163SH06302010121561  20101215

Output File:
H1036799    ANDERSON    TIM     119220101 163SH06302010121561  20101215
H1036800    ANDERSON    JIM     119220101 166SH06302010121561  20101215
H1036801    TAMMY       TIM     119220101 161SH06302010121561  20101215
H1036802    RINONLD     BOB     119220101 166SH06302010121561  20101215
H1036803    PETER       PRKER   119220101 163SH06302010121561  20101215
H1036804    DONALD      MC      119220101 163SH06302010121561  20101215

After creating the output file, I need the control report in the below format.
PROGRAM-R01                             XYZ COMPANY                                          PAGE: 1
RUN DATE: 10/26/06                     HARTFORD                                   STANDARD REPORT
RUN TIME: 09:12:41           EDITED FILE TRANSACTION CONVERSION
CONTROL REPORT

3.0 TOTAL RECORDS 72 TRNS CODE CONVERTED TO 63: 2
4.0 TOTAL RECORDS 76 TRNS CODE CONVERTED TO 66: 3
5.0 TOTAL UNPROCESSED RECORDS: 90

*** END OF REPORT ***

Prasanna G

Posts: 68
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to find the number of records altered using DFSORT

Sigh. I wanted you to show me the corresponding output for your input example. You show 100 records read but I only see 7 input records in your example. So shouldn't it be 7 records read (or 6 depending on whether you want to count the header)? Please, please show me the correct expected values for the control report so I can verify that I understand what you're trying to do. That is, fill in the correct values for the question marks here:

3.0 TOTAL RECORDS 72 TRNS CODE CONVERTED TO 63: ?
4.0 TOTAL RECORDS 76 TRNS CODE CONVERTED TO 66: ?
5.0 TOTAL UNPROCESSED RECORDS: ?

based on your input example of:

H1036799    ANDERSON    TIM     119220101 172SH06302010121561  20101215
H1036800    ANDERSON    JIM     119220101 176SH06302010121561  20101215
H1036801    TAMMY       TIM     119220101 161SH06302010121561  20101215
H1036802    RINONLD     BOB     119220101 176SH06302010121561  20101215
H1036803    PETER       PRKER   119220101 172SH06302010121561  20101215
H1036804    DONALD      MC      119220101 163SH06302010121561  20101215

Please take some time and get it right so I don't have to ask again. I shouldn't have to guess.
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

Frank Yaeger
Global moderator

Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Re: How to find the number of records altered using DFSORT

Am extremely sorry Frank.
Here is what the control report has to look like for the input file that I have provided previously

3.0 TOTAL RECORDS 72 TRNS CODE CONVERTED TO 63: 2
4.0 TOTAL RECORDS 76 TRNS CODE CONVERTED TO 66: 2
5.0 TOTAL UNPROCESSED RECORDS: 2

Prasanna G

Posts: 68
Joined: Tue Apr 12, 2011 9:49 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to find the number of records altered using DFSORT

You can use a DFSORT job like the following to do what you asked for:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//OUT DD DSN=...     output file (FB/80)
//RPT DD DSN=...     control file (FB/120)
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'000')),
OVERLAY=(81:C'000')),
IFTHEN=(WHEN=(44,2,CH,EQ,C'72'),
OVERLAY=(44:C'63',81:C'1')),
IFTHEN=(WHEN=(44,2,CH,EQ,C'76'),
OVERLAY=(44:C'66',82:C'1')),
IFTHEN=(WHEN=NONE,
OVERLAY=(83:C'1'))
OUTFIL FNAMES=OUT,BUILD=(1,80)
OUTFIL FNAMES=RPT,REMOVECC,NODETAIL,
OVERLAY=(120:X),
TRAILER1=('PROGRAM-R01',41:'XYZ COMPANY',
94:'PAGE: ',PAGE=(M10,LENGTH=3),/,
'RUN DATE: ',DATE=(MDY/),40:'HARTFORD',83:'STANDARD REPORT',/,
'RUN TIME: ',TIME=(24:),30:'EDITED FILE TRANSACTION CONVERSION',
/,47:'CONTROL REPORT',/,X,/,
'3.0 TOTAL RECORDS 72 TRNS CODE CONVERTED TO 63: ',
TOT=(81,1,ZD,M10,LENGTH=8),/,
'4.0 TOTAL RECORDS 76 TRNS CODE CONVERTED TO 66: ',
TOT=(82,1,ZD,M10,LENGTH=8),/,
'5.0 TOTAL UNPROCESSED RECORDS: ',
TOT=(83,1,ZD,M10,LENGTH=8),/,X,/,X,/,
50:'*** END OF REPORT ***')
/*
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

Frank Yaeger
Global moderator

Posts: 1079
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 15 times

Next