View previous topic :: View next topic
|
Author |
Message |
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi
Here is my requirement!!
i've VSAM KSDS File which has aroung 1 million records.
CopyBook Layout:
----------------------
Column -1 (1-23)
Column-2 (24-8)
Column-3 (33-3)
column -1 & Column-2 are part of the Key. i want to group the column-3??
for eg:
---------
xxxxxxx1234556666666611ind
sarathtt1111111111111111ind
yyyyyyy222222222222222ind
aaaaaaa333333333333333usa
cccccccc444444444444444usa
ddddddd555555555555555usa
output:
--------
column-3 count
---------- -------
ind 3
usa 3
i want to generate the report for the column-3 count(as mentioned above).. so can you guys provide me the JCL for the same...assume that this is an urgent requirement!!!! |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I suppose that this link may help you:
http://ibmmainframes.com/viewtopic.php?t=5339
and in your case the icetool will be(if I learned something):
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
XXXXXXX1234556666666611 IND
SARATHTT1111111111111111 IND
YYYYYYY222222222222222 IND
AAAAAAA333333333333333 USA
CCCCCCCC444444444444444 USA
DDDDDDD555555555555555 USA
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) TO(OUT) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION ZDPRINT
INREC FIELDS=(33,3,5:C'000001')
SORT FIELDS=(1,3,CH,A)
SUM FIELDS=(5,6,ZD)
OUTREC FIELDS=(1,10,70X) |
In Outrec I imagined a file with logical record length of 80.
I hope in this help. |
|
Back to top |
|
|
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi
Can you guys explain me how does the below JCL works!!!
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
AAA-0001-BB-F
AAA-0002-CC-F
AAA-0003-CC-F
AAA-0005-DD-F
BBB-0009-AA-F
/*
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,
OUTREC=(C'1',1,3,6:C'0001'/,
C'3',13,1,6:5,4,/,
C'2',10,2,6:C'0001')
//CTL2CNTL DD *
OPTION ZDPRINT
SORT FIELDS=(1,4,CH,A)
SUM FIELDS=(6,4,ZD)
OUTREC FIELDS=(2,8) |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I suppose that you have just read the post and so it's simple...
The sample that I was looking for is useful to group and/or sum as you do in DB2 for a procedure that I'm still writing with the aid of ICETOOL.
What Mr. Frank gave to me is what I need...
To brief how its work:
The main work is done in CTL1CNTL where the record is formatted for the sum; in some cases I(but is from Frank) will sum a costant(that's always 1) and in other cases, where I've a numeric field I will sum that.
In CTL2CNTL there is the SUM with the aid of ZDPRINT option and at the end a OUTREC that will format my output.
(I'm sure that Mr. Frank is more clear than me... so I hope in his help)
But the sample that I wrote above is for your use(the link is only another sample)
I tried it and it work very fine.
If you have some doubt try to post them. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
The DFSORT job I gave in that other link was for a more complicated case. This one is simple. You can use the following DFSORT/ICETOOL job to get this report:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//RPT DD SYSOUT=*
//TOOLIN DD *
OCCUR FROM(IN) LIST(RPT) VSAMTYPE(F) -
HEADER('Column-3') ON(33,3,CH) -
HEADER('Count') ON(VALCNT,U06)
/*
|
RPT will have:
Code: |
Column-3 Count
-------- -------
ind 3
usa 3
|
|
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
I want to apologize to ykishore and ask to you one doubt.
In this case, apart the layout of the report, is not better use as input a file with 10 bytes to do what he need? Which difference are there between an inrec option and your method?(always in term of performance and space)
Thanks in advance |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
MGindaco,
If you look at the DFSMSG output for the OCCUR step, you'll see that OCCUR actually uses INREC, so I wouldn't expect much difference. |
|
Back to top |
|
|
MGIndaco
Active User
Joined: 10 Mar 2005 Posts: 432 Location: Milan, Italy
|
|
|
|
Ok, I tested it.
Now I know the reply.
Many thanks |
|
Back to top |
|
|
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
HI
Thanx alot!!!! |
|
Back to top |
|
|
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi
Thanx a lot for ur help!!!! ...how to ge the count of all occurences...
for eg:
output:
---------
column-3 count
----------- -------
ind 3
usa 3
-----
Total: 6
i want the report as mentioned above.....you guys please provide me the JCL!!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Kishore.Y,
Here's a DFSORT job that will do what you want. (This is my last post for a while.)
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(33,3,CH,A)
RECORD TYPE=F
OUTFIL REMOVECC,NODETAIL,
HEADER2=('Country',15:' Count',/,
'--------',15:'------'),
SECTIONS=(33,3,
TRAILER3=(33,3,15:COUNT=(M10,LENGTH=6))),
TRAILER1=(12:13'-',/,'Total count:',15:COUNT=(M10,LENGTH=6))
/*
|
|
|
Back to top |
|
|
ykishore
New User
Joined: 12 Aug 2005 Posts: 53 Location: USA
|
|
|
|
Hi
when i tried to execute the above JCL ,got the below error!!!
OUTFIL STATEMENT : SYNTAX ERROR .. can u guys let me know , watz the problem!!! |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
That's a Syncsort error message. The job works fine with DFSORT. Apparently, Syncsort does not support something in these DFSORT control statements. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I can't help you with Syncsort questions or problems. |
|
Back to top |
|
|
|