View previous topic :: View next topic
|
Author |
Message |
gcchowdary Warnings : 1 New User
Joined: 26 Dec 2005 Posts: 18 Location: India
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
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 |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
I suspect that will give the total of both files not the total of each file. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
|
|
Right Nic, I have misunderstood the situation then. Thanks |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
Back to top |
|
|
Mohamed Tharwat
New User
Joined: 01 Jul 2014 Posts: 6 Location: Egypt
|
|
|
|
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 |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3051 Location: NYC,USA
|
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
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 |
|
|
|