MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

count records including header and trailer

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 1:57 pm    Post subject: count records including header and trailer Reply with quote

Hi,

I want to insert header and trailer records in output file.
In trailer record I want count of all records of input file including header and trailer record.


Thanks,
Arpit
Back to top
View user's profile Send private message
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 1:58 pm    Post subject: Reply with quote

Forget to mention.
I want this by using Sort card.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jun 14, 2007 2:03 pm    Post subject: Reply with quote

v_arpit wrote:
Forget to mention.
I want this by using Sort card.


Well...you also forgot to search the forums....Just a simple search for Header/Trailer AND SORT would have got you so many posts.

Check this,
http://www.mvsforums.com/helpboards/viewtopic.php?t=5398

Thanks,
Phantom
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jun 14, 2007 2:18 pm    Post subject: Reply with quote

Arpit,

Please show an example of your input records and what you expect for output.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 3:46 pm    Post subject: Reply with quote

Hi,

If my input file having 4 records as below
D111111
D111112
D111113
D111114


then expected output should be
D111111
D111112
D111113
D111114
T 5


Please help.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Thu Jun 14, 2007 3:48 pm    Post subject: Reply with quote

v_arpit,
what about your header record?
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 3:52 pm    Post subject: Reply with quote

Yes output record is like
HARPIT
D111111
D111112
D111113
D111114
T 5
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Thu Jun 14, 2007 4:06 pm    Post subject: Reply with quote

Ok...If your header record is hardcoded, then you could try the following.

Code:

//R010   EXEC  PGM=SORT
//SORTIN   DD  DSN=your.input.file,
//             DISP=SHR
//SORTOUT  DD  DSN=your.output.file,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(trk,(x,y),rlse)
//SYSOUT   DD  SYSOUT=*
//SYSIN    DD  *
  SORT FIELDS=COPY
  OUTFIL HEADER1=('HARPIT'),
        TRAILER1=('T ',COUNT),REMOVECC
/*


The REMOVECC parm in OUTFIL statement is used to Suppress the ANSI Print control characters. If you do not use this, your output file will be created as FBA with 1 byte more than your expected LRECL

Hope this helps,

Thanks,
Phantom
Back to top
View user's profile Send private message
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 4:46 pm    Post subject: Reply with quote

I tried but this give me only detail records count.
I want detail records + header and trailer count.
e.g.
HARPIT
D111111
D111112
D111113
D111114
T 6


But this gives me
HARPIT
D111111
D111112
D111113
D111114
T 4
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jun 14, 2007 5:13 pm    Post subject: Reply with quote

v_arpit,

Try these control cards
Code:

//SYSIN    DD *                       
  SORT FIELDS=COPY           
  OUTFIL REMOVECC,                   
  HEADER1=('HARPIT'),                 
 TRAILER1=('T ',COUNT+2=(M10,LENGTH=8))
/*


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 5:40 pm    Post subject: Reply with quote

Thanks.
It works.

could you please explain me the significance of M10. And what is the maximum length of trailer count.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jun 14, 2007 5:43 pm    Post subject: Reply with quote

Quote:

could you please explain me the significance of M10. And what is the maximum length of trailer count


check this link for m10 edit mask

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jun 14, 2007 5:45 pm    Post subject: Reply with quote

M10 is one of the 27 DFSORT edit masks. It displays the count with leading zeros suppressed. The maximum length of the trailer count is 15 digits.

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
v_arpit
Beginner


Joined: 25 Sep 2006
Posts: 10
Topics: 2

PostPosted: Thu Jun 14, 2007 6:12 pm    Post subject: Reply with quote

thanks alot.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities 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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group