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
 

 

How to find total number of records from more than one file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
gcchowdary
Warnings : 1

New User


Joined: 26 Dec 2005
Posts: 18
Location: India

PostPosted: Wed Jul 09, 2014 9:24 pm    Post subject: How to find total number of records from more than one file
Reply with quote

Hi ,

I need to find the total number of records from more than one file.

for example

input files :
file1 - it has 12 records
file2 - it has 20 records
file3 - it has 30 records

output file
12
20
30

I know how to get no of records for one file as below :

//SORT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ABC1.FT.LR.BDK.FRS.DS.DLREXPT.D140701,DISP=SHR
//SORTOUT DD DSN=DES.REC.COUNT.TEST,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(10,5),RLSE)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=9))
/*


Please let me know how to include more than one file and out put should be in one file .

Thank you
Chowdary
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Wed Jul 09, 2014 10:09 pm    Post subject: Reply to: How to find total number of records from more than
Reply with quote

You've been around long enough to know to use the Code tags.

Why would you want to do this? If you need to know the number of records, surely the design of the system came up with a more efficient way than counting them separately.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Jul 10, 2014 12:26 am    Post subject:
Reply with quote

Code:
//*-----------------------------------------------------------------*
//STEP01   EXEC PGM=SORT                                             
//*-----------------------------------------------------------------*
//SYSTSPRT DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//SYSUDUMP DD SYSOUT=*                                               
//SYSPRINT  DD SYSOUT=*                                               
//SORTIN   DD DSN=RXXXXX1.SORT.IN,DISP=SHR                           
//         DD DSN=RXXXXX2.SORT.IN1,DISP=SHR                           
//SORTOUT  DD DSN=RX00510.SORT.OUT,                                   
//             DISP=(,CATLG,DELETE),                                 
//             SPACE=(CYL,(1,1),RLSE),                               
//             UNIT=SYSDA                                             
//SYSIN   DD *                                                       
  SORT FIELDS=COPY                                                   
    OUTFIL REMOVECC,NODETAIL,                                         
     TRAILER1=('NO OF RECORDS: ',COUNT=(M11,LENGTH=8))               
/*                                                                   


This is tested and working fine. As mentioned by Bill use the code tags henceforth.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Thu Jul 10, 2014 12:47 am    Post subject: Reply to: How to find total number of records from more than
Reply with quote

I suspect that will give the total of both files not the total of each file.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Jul 10, 2014 12:53 am    Post subject:
Reply with quote

Right Nic, I have misunderstood the situation then. Thanks
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Thu Jul 10, 2014 12:55 am    Post subject:
Reply with quote

Indubitably.

How about a Rexx scripette to fabricate from a skeleton a job with multiple sort steps, and one final step to scrapes the sysouts from each one and assemble them into a single report? Assuming, of course, that Mr. Woodger's assumption about application quality is incorrect icon_wink.gif
Back to top
View user's profile Send private message
Mohamed Tharwat

New User


Joined: 01 Jul 2014
Posts: 6
Location: Egypt

PostPosted: Fri Jul 11, 2014 5:11 pm    Post subject: Reply to: How to find total number of records from more than
Reply with quote

I think you can use GROUP function in sort then PUSH a flag or something that can make records of each file unique, then check by IFTHEN on this flag, if first flag file => count, and so on for all your files.
Sorry for not providing code cause i am share this from mobile.

Regards,
Tharwat
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Sat Jul 12, 2014 12:34 am    Post subject:
Reply with quote

As Bill asked , why do you need that anyways? and if you think the SORT goes difficult then a simple COBOL program can give you what you expect.

And at last see if this helps,
http://www.ibmmainframes.com/about54169-0-asc-15.html
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 159
Location: Chennai

PostPosted: Sat Jul 12, 2014 10:48 am    Post subject: Reply to: How to find total number of records from more than
Reply with quote

This should help you, try adding your datasets and let us know the results.

Code:

//CPYJK EXEC PGM=ICETOOL   
//TOOLMSG DD SYSOUT=*       
//SYSOUT DD SYSOUT=*       
//DFSMSG DD SYSOUT=*       
//IN1 DD *                 
1                           
2                           
3                           
//IN2 DD *                 
2                           
3                           
//IN3 DD *                 
4                           
//OUT1 DD SYSOUT=*         
//TOOLIN DD *               
COUNT FROM(IN1) WRITE(OUT1)
COUNT FROM(IN2) WRITE(OUT1)
COUNT FROM(IN3) WRITE(OUT1)


Regards,
Magesh
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
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 How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm


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