IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Counting the records in blocks


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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: 2481
Location: @my desk

PostPosted: Tue Aug 10, 2010 6:51 pm
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
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: 2481
Location: @my desk

PostPosted: Tue Aug 10, 2010 7:02 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Tue Aug 10, 2010 7:11 pm
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: 2481
Location: @my desk

PostPosted: Tue Aug 10, 2010 8:04 pm
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
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: 2481
Location: @my desk

PostPosted: Thu Aug 12, 2010 2:52 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top