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
 

 

Including Record Count to header record

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

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Tue Apr 28, 2009 7:14 pm    Post subject: Including Record Count to header record
Reply with quote

I have a file as below

Code:

Acc1 Security1 H
Acc1 Security1 T
Acc1 Security1 T
Acc1 Security1 T
Acc1 Security2 H
Acc1 Security2 T
Acc1 Security2 T
Acc1 Security3 H
Acc1 Security3 T


and the output should be as

Code:

Acc1 Security1 H 3
Acc1 Security1 T
Acc1 Security1 T
Acc1 Security1 T
Acc1 Security2 H 2
Acc1 Security2 T
Acc1 Security2 T
Acc1 Security3 H 1
Acc1 Security3 T


where the newly added fields as part of 'H' records are count of the 'T' records.

Is this possible to be implemented using SORT ?
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue Apr 28, 2009 10:25 pm    Post subject:
Reply with quote

The following DFSORT/ICETOOL JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD *                                           
----+----1----+----2----+----3----+----4----+----5----+----
ACC1 SECURITY1 H                                           
ACC1 SECURITY1 T                                           
ACC1 SECURITY1 T                                           
ACC1 SECURITY1 T                                           
ACC1 SECURITY2 H                                           
ACC1 SECURITY2 T                                           
ACC1 SECURITY2 T                                           
ACC1 SECURITY3 H                                           
ACC1 SECURITY3 T                                           
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  COPY FROM(IN) USING(CTL1)                               
  SORT FROM(T1) USING(CTL2)                               
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=T1,REMOVECC,                               
  SECTIONS=(6,9,TRAILER3=(6:6,9,17:COUNT-1=(M10,LENGTH=8)))
//CTL2CNTL DD *                                           
  SORT FIELDS=(6,9,CH,A,17,8,CH,D),EQUALS                 
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(16,1,CH,EQ,C' '),       
  RECORDS=2,PUSH=(17:17,8))                               
  OUTFIL FNAMES=OUT,OMIT=(16,1,CH,EQ,C' ')                 
/*                                                         
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Apr 29, 2009 10:23 am    Post subject:
Reply with quote

Thanks Kolusu. Getting the results, if i run with one acct.

When executing with below input
Code:

ACC1 SECURITY1 H
ACC1 SECURITY1 T
ACC1 SECURITY1 T
ACC1 SECURITY1 T
ACC1 SECURITY2 H
ACC1 SECURITY2 T
ACC1 SECURITY2 T
ACC1 SECURITY3 H
ACC1 SECURITY3 T
ACC2 SECURITY1 H
ACC2 SECURITY1 T
ACC2 SECURITY1 T
ACC2 SECURITY1 T
ACC2 SECURITY2 H
ACC2 SECURITY2 T
ACC2 SECURITY2 T
ACC2 SECURITY3 H
ACC2 SECURITY3 T


Output is as below
Code:

ACC1 SECURITY1 H       3
ACC1 SECURITY1 T       
ACC1 SECURITY1 T       
ACC1 SECURITY1 T       
ACC2 SECURITY1 H       
ACC2 SECURITY1 T       
ACC2 SECURITY1 T       
ACC2 SECURITY1 T       
ACC1 SECURITY2 H       2
ACC1 SECURITY2 T       
ACC1 SECURITY2 T       
ACC2 SECURITY2 H       
ACC2 SECURITY2 T       
ACC2 SECURITY2 T       
ACC1 SECURITY3 H       1
ACC1 SECURITY3 T       
ACC2 SECURITY3 H       
ACC2 SECURITY3 T       


It should have been as
Code:

ACC1 SECURITY1 H       3
ACC1 SECURITY1 T       
ACC1 SECURITY1 T       
ACC1 SECURITY1 T       
ACC1 SECURITY2 H       2
ACC1 SECURITY2 T       
ACC1 SECURITY2 T       
ACC1 SECURITY3 H       1
ACC1 SECURITY3 T       
ACC2 SECURITY1 H       3
ACC2 SECURITY1 T       
ACC2 SECURITY1 T       
ACC2 SECURITY1 T       
ACC2 SECURITY2 H       2
ACC2 SECURITY2 T       
ACC2 SECURITY2 T       
ACC2 SECURITY3 H       1
ACC2 SECURITY3 T       
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Apr 29, 2009 9:52 pm    Post subject:
Reply with quote

Itanium,

You never mentioned anything about the keys in your first post. So I assumed that the key is only 9 bytes from pos 6. But looks like your key is 14 bytes length from pos1. In that case use the following JCL

Code:

//STEP0100 EXEC PGM=ICETOOL                                 
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
//IN       DD *                                             
ACC1 SECURITY1 H                                             
ACC1 SECURITY1 T                                             
ACC1 SECURITY1 T                                             
ACC1 SECURITY1 T                                             
ACC1 SECURITY2 H                                             
ACC1 SECURITY2 T                                             
ACC1 SECURITY2 T                                             
ACC1 SECURITY3 H                                             
ACC1 SECURITY3 T                                             
ACC2 SECURITY1 H                                             
ACC2 SECURITY1 T                                             
ACC2 SECURITY1 T                                             
ACC2 SECURITY1 T                                             
ACC2 SECURITY2 H                                             
ACC2 SECURITY2 T                                             
ACC2 SECURITY2 T                                             
ACC2 SECURITY3 H                                             
----+----1----+----2----+----3----+----4----+----5----+----6-
ACC2 SECURITY3 T                                             
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)   
//OUT      DD SYSOUT=*                                       
//TOOLIN   DD *                                             
  COPY FROM(IN) USING(CTL1)                                 
  SORT FROM(T1) USING(CTL2)                                 
//CTL1CNTL DD *                                             
  OUTFIL FNAMES=T1,REMOVECC,                                 
  SECTIONS=(1,14,TRAILER3=(1,14,17:COUNT-1=(M10,LENGTH=8))) 
//CTL2CNTL DD *                                             
  SORT FIELDS=(1,14,CH,A,17,8,CH,D),EQUALS                   
  OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(16,1,CH,EQ,C' '),         
  RECORDS=2,PUSH=(17:17,8))                                 
  OUTFIL FNAMES=OUT,OMIT=(16,1,CH,EQ,C' ')                   
/*                                                           
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Apr 29, 2009 9:54 pm    Post subject:
Reply with quote

Thanks Kolusu.
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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts CICS Transaction attach count of supp... lind sh CICS 1 Wed Jun 21, 2017 1:33 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am


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