View previous topic :: View next topic
|
Author |
Message |
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
I have an input file like this
KEY1 *
KEY2 *
KEY3
KEY4
KEY5 *
KEY6 *
My output file looks like this -- for each input record with '*' i have 2 records in the output file as 'KEY1' and 'KEY1 *'.
KEY1
KEY1 *
KEY2
KEY2 *
KEY3
KEY4
KEY5
KEY5 *
KEY6
KEY6 *
I need to create reports like this
1) Report from Input file
Count of '*' and ' ' records. I am doing like
OCCURS FROM(INDD) LIST(OUTDD) -
HEADER('ASTREIX') ON(6,1,CH) -
HEADER('COUNTS') ON(VALCNT,A1,N06)
ASTREIX COUNTS
2
* 4
But the count for ' ' should be 2 + 4 = 6(for each '*' there is one with ' ' -- see output file).
(a) I need to check if the count from input file is same as that in output.
(b) Also if there are any records in Input file not in output
How to accomplish this? Can anybody help. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
kalukakkad
Quote: |
My output file looks like this |
Have you already obtained this o/p?
Quote: |
But the count for ' ' should be 2 + 4 = 6(for each '*' there is one with ' ' -- see output file).
|
Please explain this a bit more |
|
Back to top |
|
|
kalukakkad
New User
Joined: 10 Mar 2005 Posts: 81
|
|
|
|
No, i haven't.
OCCURS FROM(INDD) LIST(OUTDD) -
HEADER('ASTREIX') ON(6,1,CH) -
HEADER('COUNTS') ON(VALCNT,A1,N06)
Gives me 2 as a count for KEYs without '*'. I have to get it as 6. How to do it. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
kalukakkad,
Quote: |
I have to get it as 6. How to do it. |
Still unclear. |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
kalukakkad
Quote: |
My output file looks like this |
The ICETOOL solution for generating
Code: |
----+----1
**********
KEY1
KEY1 *
KEY2
KEY2 *
KEY3
KEY4
KEY5
KEY5 *
KEY6
KEY6 *
|
is
Code: |
//*******************************************************
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
KEY1 *
KEY2 *
KEY3
KEY4
KEY5 *
KEY6 *
/*
//OUT1 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CP01)
/*
//CP01CNTL DD *
OUTFIL FNAMES=OUT1,IFTHEN=(WHEN=(6,1,CH,EQ,C'*'),
BUILD=(1,4,/,1,6))
/*
|
|
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
kalukakkad
Regarding this
Quote: |
Gives me 2 as a count for KEYs without '*'. I have to get it as 6. How to do it. |
As per my understanding you want count of all the records in the O/p, which do not have '*' in front of them right? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
kalukakkad
The complete DFSORT/ICETOOL solution for your question is here:
Code: |
//*******************************************************
//STEP001 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... i/p file
//OUT1 DD DSN=... o/p file
//REPORT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CP01)
OCCURS FROM(OUT1) LIST(REPORT) -
HEADER('ASTREIX') HEADER('COUNTS') -
ON(6,1,CH) ON(VALCNT,N06)
/*
//CP01CNTL DD *
OUTFIL FNAMES=OUT1,IFTHEN=(WHEN=(6,1,CH,EQ,C'*'),
BUILD=(1,4,/,1,6))
/*
|
o/p Report:
Code: |
----+----1----+----2
ASTREIX COUNTS
------- -------
6
* 4
|
|
|
Back to top |
|
|
|