View previous topic :: View next topic
|
Author |
Message |
lakshmikondur
New User
Joined: 05 Jan 2006 Posts: 9 Location: hyderabad
|
|
|
|
Hi,
I have a requirement to print the number of occurences of a particular value of the field in the file using the DFsort.
I/P data
20000000003400000647
20000000003400000645
20000000003400000647
20000000003400000645
20000000003400000647
20000000003400000645
20000000005500000641
20000000003400000647
O/P
0647 4(Number of times 0647 repeated)
0645 3(Number of times 0645 repeated)
0641 1(Number of times 0641 repeated)
Input file is a VB file, record lenght is 394, Field position is from 17 and length is 4 .
Please let me know the procedure to do it using DFsort.
Thanks in Advance. |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2454 Location: Hampshire, UK
|
|
|
|
ICETOOL and OCCURS has done similar for me. |
|
Back to top |
|
|
lakshmikondur
New User
Joined: 05 Jan 2006 Posts: 9 Location: hyderabad
|
|
|
|
Nic,
Thanks for your reply.
Could you please give me an example for this scenario in ICETOOL so that it will be helpful for me. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
lakshmikondur,
Is the order of records in the output file important to you? |
|
Back to top |
|
|
lakshmikondur
New User
Joined: 05 Jan 2006 Posts: 9 Location: hyderabad
|
|
|
|
Arun,
Order of the records in the output is not important to me. It can be any order.
Regards,
Lakshmi |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
lakshmikondur,
Eventhough you have mentioned the starting position of the input field as 17, I suspect that it should have been 21 since your input file is VB.
Assuming the output file to be of FB,LRECL=80, this should work for you.
Code: |
//STEP01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN= Input file --> (VB/394)
//SORTOUT DD DISP=SHR,DSN= Output file --> (FB/80)
//SYSIN DD *
INREC BUILD=(1,4,21,4)
SORT FIELDS=(5,4,CH,A)
OUTFIL VTOF,REMOVECC,NODETAIL,SECTIONS=(5,4,
TRAILER3=(5,4,X,COUNT=(M10,LENGTH=2))),BUILD=(80X) |
|
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
Hi,
here is what i used to create a report. if you dont want the report header and title, use one more step to eliminate those records with INCLUDE operator
JCL
Code: |
//STEP020 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INDD DD *
20000000003400000647
20000000003400000645
20000000003400000647
20000000003400000645
20000000003400000647
20000000003400000645
20000000005500000641
20000000003400000647
/*
//OUTDD DD DISP=(NEW,CATLG,DELETE),
// DSN=GT0734.GTS758.PER.JCL.OUTPUT,
// SPACE=(CYL,(20,25),RLSE),
// LRECL=80,BLKSIZE=0,RECFM=FBA,DSORG=PS
//TOOLIN DD *
OCCUR FROM(INDD) LIST(OUTDD) -
LINES(999) -
TITLE('REPORT OF NUMBER OF OCCURENCES') -
HEADER('FIELD VALUE') ON(17,4,CH) -
HEADER('NO OF OCCURENCE') ON(VALCNT,N15)
/* |
Output file
Code: |
********************************* Top of Data **********************************
REPORT OF NUMBER OF OCCURENCES
FIELD VALUE NO OF OCCURENCE
----------- ----------------
0641 1
0645 3
0647 4
******************************** Bottom of Data ******************************** |
Note for your VB input file, you need to add RDW of 4 bytes. so TOOLIN should have ON(21,4,CH) |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
here is what i used to create a report. if you dont want the report header and title, use one more step to eliminate those records with INCLUDE operator
|
or possibly just remove the control cards that generate the report headings??????? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
exactly this question, ok different record layout , not difficult to change,
has been asked and the solution has been provided
at least three times in the last two days
why in heaven people do not search a bit before asking |
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
[quote="dbzTHEdinosauer"]
Quote: |
or possibly just remove the control cards that generate the report headings??????? |
you will still get the default headers anyway
Code: |
//OUTDD DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(INDD) LIST(OUTDD) -
ON(17,4,CH) -
ON(VALCNT,N15)
/*
|
output
Code: |
********************************* Top of Data **********************************
(17,4,CH) VALUE COUNT
0641 1
0645 3
0647 4
******************************** Bottom of Data ******************************** |
|
|
Back to top |
|
|
lakshmikondur
New User
Joined: 05 Jan 2006 Posts: 9 Location: hyderabad
|
|
|
|
Thank you all for the quick responses.
I have tried with the ICETOOl and it is working. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
you will still get the default headers anyway |
You can use the NOHEADER operand to eliminate the headers. |
|
Back to top |
|
|
|