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
 

 

Counting the records in blocks

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Tue Aug 03, 2010 5:24 pm    Post subject: Counting the records in blocks
Reply with quote

Hello,

I have the following scenario, where the input file is organized in blocks. An 'AA' marks the start of a new block. Within a block, there can be sub-blocks that starts with BB and ends with DD. Data in column 3 is same across a block.

I need to find the number of sub-blocks within each block (count to be displayed in AA record)

Input File

Code:
AA1
BB1
DD1
BB1
CC1
DD1
BB1
DD1
AA2
BB2
DD2


Output file

Code:
AA1 03
BB1
DD1
BB1
CC1
DD1
BB1
DD1
AA2 01
BB2
DD2


The following code may not be the efficient one but works fine.

Code:
  INREC IFTHEN=(WHEN=INIT,BUILD=(1:1,3,4:SEQNUM,4,ZD,           
                                 8:SEQNUM,2,ZD,RESTART=(3,1))),
        IFTHEN=(WHEN=(1,2,CH,EQ,C'DD'),OVERLAY=(10:C'01')),     
        IFTHEN=(WHEN=(1,2,CH,NE,C'DD'),OVERLAY=(10:C'00'))     
  SORT FIELDS=(3,1,CH,A)                                       
  SUM FIELDS=(10,2,ZD),XSUM                                     


In the next step, the sortout and the XSUM files were merged using the below sort card,

Code:
  SORT FIELDS=(4,4,CH,A)                     
  OUTFIL FNAMES=SORTOUT,                     
         IFTHEN=(WHEN=(1,2,CH,EQ,C'AA'),     
         BUILD=(1:1,3,X,5:10,2)),             
         IFTHEN=(WHEN=(1,2,CH,NE,C'AA'),     
         BUILD=(1:1,3,3X))                   


But I need some expertise to have this sort in single step/a better one.

(Sorry if i ve been in the wrong forum)

Thanks
- Pradeep
Back to top
View user's profile Send private message

spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Tue Aug 10, 2010 6:16 pm    Post subject:
Reply with quote

Hi All,

Any luck ?

- Pradeep

* I sent a PM to Syncsort concerning this. - Kevin
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Tue Aug 10, 2010 6:51 pm    Post subject:
Reply with quote

You can achieve it in a single step SYNCTOOL without much sort overhead in some alternate way. but i doubt if you can save a data pass.
Back to top
View user's profile Send private message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Tue Aug 10, 2010 6:58 pm    Post subject:
Reply with quote

Yes Arun.

It can be done using Synctool. But I should say that data pass within same step is not practised in our org.

Thanks
- Pradeep
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Tue Aug 10, 2010 7:02 pm    Post subject:
Reply with quote

Even using multiple steps i think you can save a bit of "sort" overhead. I will try to post a bit of code.

What are your input/output file attributes. Also which version of sort you're using? You'll find it in your sysout.
Back to top
View user's profile Send private message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Tue Aug 10, 2010 7:09 pm    Post subject:
Reply with quote

Yes Arun.

Any efficient logic to get this done would be fine. Single step solution would be just an added value.

Thanks
- Pradeep
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Aug 10, 2010 7:11 pm    Post subject:
Reply with quote

Why the need for a single step. As Arun has said, it may not be possible to reduce the number of data passes, so wht is the great thing about spending time and money on a solution that doesn't use any less cpu or elapsed time ?
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Tue Aug 10, 2010 8:04 pm    Post subject:
Reply with quote

Adding to what expat has told, If you find any difficulty in posting the requested info let us know, we'll help you.
Back to top
View user's profile Send private message
spradeepece

New User


Joined: 25 Jun 2008
Posts: 19
Location: Chennai

PostPosted: Thu Aug 12, 2010 12:58 pm    Post subject:
Reply with quote

Arun / Expat,

I am OK for multiple step, provided the logic is better. Wherein I dont remove duplicates using XSUM, and merge them again in the next step. Which I feel is a bit of revamping work.

Was just curious if there could be another solution.

Thanks anyways. I ve got it done already. icon_smile.gif

Thanks
- Pradeep
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2275
Location: @my desk

PostPosted: Thu Aug 12, 2010 2:52 pm    Post subject:
Reply with quote

Quote:
Was just curious if there could be another solution
There can be multiple solutions for the same problem. And there may be better solutions than the one you have got.
It is upto you to decide which one you want to go with.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


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