Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Number of occurences of a value in the field using JCL sort.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
lakshmikondur

New User


Joined: 05 Jan 2006
Posts: 9
Location: hyderabad

PostPosted: Fri Feb 24, 2012 10:30 am    Post subject: Number of occurences of a value in the field using JCL sort.
Reply with quote

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
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1717
Location: UK

PostPosted: Fri Feb 24, 2012 10:52 am    Post subject:
Reply with quote

ICETOOL and OCCURS has done similar for me.
Back to top
View user's profile Send private message
lakshmikondur

New User


Joined: 05 Jan 2006
Posts: 9
Location: hyderabad

PostPosted: Fri Feb 24, 2012 11:09 am    Post subject: Reply to: Number of occurences of a value in the field using
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2171
Location: @my desk

PostPosted: Fri Feb 24, 2012 11:29 am    Post subject:
Reply with quote

lakshmikondur,

Is the order of records in the output file important to you?
Back to top
View user's profile Send private message
lakshmikondur

New User


Joined: 05 Jan 2006
Posts: 9
Location: hyderabad

PostPosted: Fri Feb 24, 2012 11:32 am    Post subject: Reply to: Number of occurences of a value in the field using
Reply with quote

Arun,

Order of the records in the output is not important to me. It can be any order.

Regards,
Lakshmi
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2171
Location: @my desk

PostPosted: Fri Feb 24, 2012 11:51 am    Post subject:
Reply with quote

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
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Fri Feb 24, 2012 12:24 pm    Post subject: Reply to: Number of occurences of a value in the field using
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Feb 24, 2012 12:40 pm    Post subject:
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Feb 24, 2012 12:44 pm    Post subject: Reply to: Number of occurences of a value in the field using
Reply with quote

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
View user's profile Send private message
charanmsrit

New User


Joined: 25 Oct 2007
Posts: 80
Location: Australia

PostPosted: Fri Feb 24, 2012 12:53 pm    Post subject:
Reply with quote

[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
View user's profile Send private message
lakshmikondur

New User


Joined: 05 Jan 2006
Posts: 9
Location: hyderabad

PostPosted: Fri Feb 24, 2012 2:58 pm    Post subject: Reply to: Number of occurences of a value in the field using
Reply with quote

Thank you all for the quick responses.

I have tried with the ICETOOl and it is working.
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: Sat Feb 25, 2012 1:03 am    Post subject:
Reply with quote

Quote:
you will still get the default headers anyway


You can use the NOHEADER operand to eliminate the headers.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 24 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us