Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Count and sum in single step

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
umanaga

New User


Joined: 09 Apr 2007
Posts: 33
Location: India

PostPosted: Thu May 17, 2012 5:39 pm    Post subject: Count and sum in single step
Reply with quote

i have a requirement as below

Code:
A 12{
B 13{
A 01{

after sort
Code:

A 13{ 02
B 13{ 01


02- no of A recs, 01-no of B recs

Currently doing this in 2 steps, once to modify every rec by putting 01 and in second step use sum fields on them. Is it possible to do it in a single step.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu May 17, 2012 5:53 pm    Post subject: Reply to: Count and sum in single step
Reply with quote

Deja vu

With INREC, extend your record to include a value of 1 of the length you need.

Include the new field in the SUM statement.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 17, 2012 5:56 pm    Post subject:
Reply with quote

why not append the 01 (are you sure you can only have 99 dups?)
during INREC?

you essentially hae 3 stages to sort (please, kolusu and Frank, don't beat on me for this)

INREC/INFILE where you can do all kinds of things to records

the "sort" part where the output of INREC/INFILE is 'sorted,summed, etc'

the OUTREC/OUTFILE part where the output of the 'sort' part is available for manipulation prior to being written to the output dataset(s).
Back to top
View user's profile Send private message
umanaga

New User


Joined: 09 Apr 2007
Posts: 33
Location: India

PostPosted: Thu May 17, 2012 5:57 pm    Post subject:
Reply with quote

Sorry if i have missed to mention,

Code:
A 12{
B 13{
A 01{


data is fetched from two files using JOIN, REFORMAT, OUTFIL BUILD

After OUTFIL when using SUM fields facing abend.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu May 17, 2012 6:00 pm    Post subject: Re: Reply to: Count and sum in single step
Reply with quote

Bill Woodger wrote:
Deja vu


i, personnally, thought: FM, not again.

umanaga,

since DFSORT forum is a 'do it for you' forum and not a 'here is a hint' forum,
suggest you provide us with all of your control cards,
so that someone can repair them for you.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Thu May 17, 2012 6:02 pm    Post subject:
Reply with quote

Is this some sort of puzzler?

The only skill you list in your profile is 'discussion', yet you fail to provide any useful information.

Why don't you show what you have done so far?

The JCL AND the abend.

This would make it much easier to help you.
Back to top
View user's profile Send private message
umanaga

New User


Joined: 09 Apr 2007
Posts: 33
Location: India

PostPosted: Thu May 17, 2012 6:02 pm    Post subject:
Reply with quote

Here it is
Code:

JOINKEYS FILE=F1,FIELDS=(12,12,A)         
JOINKEYS FILE=F2,FIELDS=(12,12,A)         
REFORMAT FIELDS=(F1:4,8,3,1,12,2,F2:44,2,56,4,F1:211,2,40,16,56,16)
OUTREC FIELDS=(01:1,9,         
              10:C'xxxxxxxxxx',   
              20:10,2,13X,             
              35:12,2,13X,             
              50:14,4,11X,             
              65:18,2,13X,             
              80:165X,                   
             245:C'000000001',       
             254:20,16,                   
             270:36,16,                   
             286:208X)                                             

SORT FIELDS=(20,60,CH,A)                                           

SUM FIELDS=(245,09,ZD,254,16,ZD,270,16,ZD)
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 645
Location: Pennsylvania

PostPosted: Thu May 17, 2012 6:05 pm    Post subject:
Reply with quote

What about an input data sample and the ABEND you say you are receiving?

A better english description of the requirement would be nice as well.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu May 17, 2012 6:10 pm    Post subject: Reply to: Count and sum in single step
Reply with quote

Find the FIgure in the DFSORT manual which tells you the order in which things are processed. Compare closely to what you have coded.

Read through what has already been said.

Fix. Try again. Let us know. If it fails, post the sysout as well.

Plus, someone Coded your post for you. Don't let that happen again, but put it in the Code tags yourself. Click on the Quote button, search the forum, look up to the FAQ towards the top of each screen, etc.
Back to top
View user's profile Send private message
umanaga

New User


Joined: 09 Apr 2007
Posts: 33
Location: India

PostPosted: Thu May 17, 2012 6:10 pm    Post subject:
Reply with quote

prodiving sample input file is difficult due to file length..that is why i have given requirement and data samples my own

Abend faced when above card run is U0027

Myself kept the coding tags, after realizing its not good when viewed the post again.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 17, 2012 7:03 pm    Post subject:
Reply with quote

Hello,

You need to post the complete sysout including the message ids.

Do not post what you believe we might find useful - post all of the messages from the step. Providing the info a bit at a time only wastes everyone's time - your and ours.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Thu May 17, 2012 7:18 pm    Post subject: Reply to: Count and sum in single step
Reply with quote

Well done with the Codeing then.

You've had an hour. Have you changed the OUTREC, which operates AFTER SORT/SUM, to INREC?
Back to top
View user's profile Send private message
umanaga

New User


Joined: 09 Apr 2007
Posts: 33
Location: India

PostPosted: Thu May 17, 2012 9:19 pm    Post subject:
Reply with quote

exactly..i tried changing the OUTREC to INREC after reading complete thread as suggested by you guys.

Thanks.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu May 17, 2012 9:28 pm    Post subject:
Reply with quote

umanaga,
Not sure what you are trying to do here if this is your sort card as of now and IF it produced sample input as you have shown, using OUTFIL SECTIONS,NODETAIL, with COUNT, will get desired results....

Read about SECTIONS here OR provide sample input records.

something like below,..obviously untested.... Check OUTFIL closely...

Code:
JOINKEYS FILE=F1,FIELDS=(12,12,A)         
JOINKEYS FILE=F2,FIELDS=(12,12,A)         
REFORMAT FIELDS=(F1:4,8,3,1,12,2,F2:44,2,56,4,F1:211,2,40,16,56,16)
OUTREC FIELDS=(01:1,9,         
              10:C'xxxxxxxxxx',   
              20:10,2,13X,             
              35:12,2,13X,             
              50:14,4,11X,             
              65:18,2,13X,             
              80:165X,                   
             245:C'000000001',       
             254:20,16,                   
             270:36,16,                   
             286:208X)                                             

SORT FIELDS=(20,60,CH,A)                                           

SUM FIELDS=(245,09,ZD,254,16,ZD,270,16,ZD)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(CONTROL-BREAK FIELD,
TRAILER3=(FIELDS THAT YOU WANT,COUNT=(EDIT=(ITTTTTTT))))


Thanks,
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 17, 2012 10:37 pm    Post subject:
Reply with quote

umanaga wrote:
exactly..i tried changing the OUTREC to INREC after reading complete thread as suggested by you guys.

Thanks.


Umanaga,

Take a look at the flowchart given here and you will understand how DFSORT process the statements

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA30/1.5.4?

You are better off reformatting the record after you are done with the sorting and summing. By increasing the length of the record before sorting , you are increasing the number of bytes to be sorted. You really don't need to do as you are only padding with spaces.

Your REFORMAT record is creating a 51 byte record and you are expanding it to 493 bytes. So add the counter at byte 52 and perform the SUM. Once you are done with SUMMING you can use OUTREC to expand the record. When you use Positions to BUILD you don't have to specify the (13x,11x,13x...) as by default they will be padded with spaces.

Here are the updated control cards for your job.

Code:

//SYSIN    DD *                                                     
  JOINKEYS FILE=F1,FIELDS=(12,12,A)                                 
  JOINKEYS FILE=F2,FIELDS=(12,12,A)                                 
  REFORMAT FIELDS=(F1:4,8,3,1,12,2,F2:44,2,56,4,F1:211,2,40,16,56,16)

  INREC OVERLAY=(52:C'000000001')                                   
  SORT FIELDS=(10,10,CH,A)                                           
  SUM FIELDS=(20,16,ZD,36,16,ZD,52,9,ZD)                             

  OUTREC BUILD=(001,09,                                             
                010:C'XXXXXXXXXX',                                   
                020:10,02,                                           
                035:12,02,                                           
                050:14,04,                                           
                065:18,02,                                           
                245:52,09,                                           
                254:20,16,                                           
                270:36,16,                                           
                493:X)                                               
//*



Sqlcode1,

Did you Forget to remove the SUM FIELDS statement in your job? You would get an error as you are using OUTREC instead of INREC.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Thu May 17, 2012 11:11 pm    Post subject:
Reply with quote

Skolusu,
I was just trying to explain OP (using the same card that he had originally provided) that he could use OUTFIL SECTIONS to produce the count without having to increase length by overlaying 0s and 1s.

Just another approach, nothing else.

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us