Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

JCL SORT - Count number of records in a file

 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL
  View previous topic :: View next topic  
Author Message
goalchi27
Member


Joined: 09 Mar 2007
Posts: 3

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Mar 23, 2007 1:25 pm    Post subject: JCL SORT - Count number of records in a file Reply with quote

Hi all,
I have an input flat file containing number of records. I have to count the no of records and put the count in the output flat file. I need the data in the output file as "No of records:" as one field and the "count" as second field. Please help me out.
_________________
Thanks,
Girish Chintawar
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Fri Mar 23, 2007 7:53 pm    Post subject: Reply with quote

Hi Girish Chintawar,

Find below the SORT JCL which will do what you have asked for..

//TESTCNTX JOB (ABCD,04,T,0000),'ICE M',CLASS=K,MSGCLASS=T,
// NOTIFY=&SYSUID
//*
//JOBLIB DD DSN=ABCD.PPROD.LOAD,DISP=SHR
//*
//*
//********************************************************************
//STEP001 EXEC PGM=SORT
//********************************************************************
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,
// DSN=ABCD.VEERA.INPUT
//SORTOUT DD DISP=(NEW,CATLG,DELETE),
// DSN=ABCD.VEERA.COUNT1,
// SPACE=(CYL,(5,5),RLSE),
// UNIT=SYSDA,BLKSIZE=0
//SYSIN DD *
SORT FIELDS=COPY,
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(10:'NO OF RECORDS:',COUNT)
/*
//*

Thanks
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
2 votes
Not an useful post
Greate Post!! Salute Author
3 salutes

PostPosted: Fri Mar 23, 2007 9:24 pm    Post subject: Reply with quote

Girish,

Veera's job won't work. Here's a DFSORT job that will:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL REMOVECC,NODETAIL,
   TRAILER1=('No of records: ',COUNT=(M11,LENGTH=8))
/*


SORTOUT will have one record, e.g.

Code:

No of records: 00000002


You can change the format of the count to whatever you like using DFSORT's edit masks.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Fri Mar 23, 2007 9:31 pm    Post subject: Reply with quote

Hi, FRANK

Frank only after executing i will post my answers , its already
executed job it WILL WORK FOR SURE 100%, May be after execution
i will change the jcl so that it doesnt reflect my shop parameters
or so ...... so in doing that if i missed out something it may not work....
I AM SURE IT WILL WORK.....well can u tell me the reason as why it will not work ???

Thanks
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Mar 23, 2007 9:35 pm    Post subject: Reply with quote

How to display the count i mean =(M11,LENGTH=8)) can be tailored..


Thanks
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
2 salutes

PostPosted: Fri Mar 23, 2007 9:57 pm    Post subject: Reply with quote

Quote:
well can u tell me the reason as why it will not work ???


You will get a syntax error for:

Code:

  SORT FIELDS=COPY,


Also, SYSPRINT isn't needed and BLKSIZE=0 isn't needed.

Quote:
How to display the count i mean =(M11,LENGTH=8) can be tailored..


I don't understand this. What are you trying to say? Are you asking a question or making a statement?
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Mar 23, 2007 10:06 pm    Post subject: Reply with quote

Yeah Frank got the point its a copy paste problem.... Smile an extra , ....while foramting it wud have appeared ..but i was wondering as what is wrong since i have put the code only after execution...well ignore my other question i taught u were saying my JCL is wrong because i dint specify the format for the count. Well i am sorry Smile

Thanks
Veera.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Frank Yaeger
Moderator


Joined: 18 Feb 2006
Posts: 812
Location: San Jose, CA

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Fri Mar 23, 2007 10:27 pm    Post subject: Reply with quote

Veera,

I'm happy to hear you tested your solution before posting it. I guess you just have to be more careful doing the copy and paste. COUNT without editing is fine if the result happens to be what's needed, but COUNT with editing is more flexible. Peace.

P.S. In the future, I'd suggest using BBCodes to make the code more readable.
_________________
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Veera
Moderator


Joined: 22 Feb 2006
Posts: 111

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri Mar 23, 2007 10:48 pm    Post subject: Reply with quote

Hi Frank,

Yes will take care in future. Thanks for the info.

Thanks and Regards,
Veera
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
academyindia4
Guest





Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Mon Feb 01, 2016 11:03 pm    Post subject: Topic deleted by Admin Reply with quote

<< Content deleted By Admin >>
Back to top
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL All times are GMT + 5 Hours
Page 1 of 1



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts Search Batch file-aid help 14 frenchman 31561 Mon Feb 01, 2016 10:23 pm
academyindia4 View latest post
No new posts File-Aid Help 3 Nicholas 21374 Mon Feb 01, 2016 10:22 pm
academyindia4 View latest post
No new posts Hi plz help me out 7 Guest 21197 Mon Feb 01, 2016 10:14 pm
academyindia4 View latest post
No new posts Need urgent HELP 4 Sulagna 12528 Mon Feb 01, 2016 1:39 am
academyindia4 View latest post
This topic is locked: you cannot edit posts or make replies. executing java program thru JCL 6 Guest 24809 Tue Feb 12, 2013 1:56 pm
Anuj Dhawan View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-2373.html