View previous topic :: View next topic
|
Author |
Message |
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
Hi
I have an input file as given below.
Tot : 2
abcd
egfh
Tot : 3
pbcf
fgrn
sgfd
Now i want the output with a header of total records as 5 i.e it should be as given below.
Total no of records : 5
abcd
egfh
fgrn
pbcf
sgfd
The sum , count or any such statistics is working with TRAILER syntax but how do we get the same in HEADER . Can anybody let me know more on this. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Ambili,
Quote: |
The sum , count or any such statistics is working with TRAILER syntax but how do we get the same in HEADER . |
This require two passes. In first pass create HEADER record ALONE in a separte file (with trailer option). Concatenatee this file with your actual data. |
|
Back to top |
|
|
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
murmohk1 wrote: |
Ambili,
Quote: |
The sum , count or any such statistics is working with TRAILER syntax but how do we get the same in HEADER . |
This require two passes. In first pass create HEADER record ALONE in a separte file (with trailer option). Concatenatee this file with your actual data. |
Hi
I want the Total record count to appear in header. What should be the syntax to get the sum of both the total(i.e Tot : 2 and Tot : 3 )
. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
You put the count in a trailer, but make the trailer look like your header.
Then get that trailer into the header position. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Ambili,
Here's a DFSORT/ICETOOL job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTDIAG DD DUMMY
//IN DD *
Tot : 2
abcd
egfh
Tot : 3
pbcf
fgrn
sgfd
/*
//***> Use MOD data set for //OUT
//OUT DD DISP=MOD,DSN=... output file
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(IN) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OMIT COND=(1,5,CH,EQ,C'Tot :',OR,1,5,CH,EQ,C' ')
OUTFIL FNAMES=OUT,REMOVECC,NODETAIL,
TRAILER1=('Total no of records :',COUNT=(M10,LENGTH=2),/)
/*
//CTL2CNTL DD *
OMIT COND=(1,5,CH,EQ,C'Tot :',OR,1,5,CH,EQ,C' ')
SORT FIELDS=(1,4,CH,A)
/*
|
|
|
Back to top |
|
|
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
Thanks Frank
It has worked . That was very much explanatory. |
|
Back to top |
|
|
|