IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

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


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jul 09, 2014 10:09 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Jul 10, 2014 12:26 am
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: 2455
Location: Hampshire, UK

PostPosted: Thu Jul 10, 2014 12:47 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Thu Jul 10, 2014 12:53 am
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: 1788
Location: Bloomington, IL

PostPosted: Thu Jul 10, 2014 12:55 am
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
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Sat Jul 12, 2014 12:34 am
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,
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: 213
Location: Chennai

PostPosted: Sat Jul 12, 2014 10:48 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top