MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Increment counter based on matching fields

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
Martin
Beginner


Joined: 20 Mar 2006
Posts: 133
Topics: 58

PostPosted: Thu Jun 04, 2009 11:47 am    Post subject: Increment counter based on matching fields Reply with quote

Hi All,

I need to increment the counter ( Pos :131 - line 5) based on value present in Line 8. example below


I need to match the value from line 16 and compare it with value in line 8. If the values match , I need to increment the counter in line ( 16 - 3 = 13).. So on

File is FB and LRECL is 150



Code:

x
x
x
x
x               1
x
x
8
x
x
x
x
x               2
x
x
8
x
x
x
x
x               1
x
x
9
x
x
x
x
x               2
x
x
9
x
x
x
x
x               3
x
x
9
x
x
x
x
x               4
x
x
9
x
x
x
x
x               1
x
x
10
x
x
x
x
x               1
x
x
11



We do NOT have the latest patch from DFSORT. ( WHEN =GROUP)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Jun 04, 2009 1:12 pm    Post subject: Reply with quote

martin,

The following DFSORT/ICETOOL JCl will give you the desired results. I assumed that the value you need to check is in pos 1 for 5 bytes and the seqnum field to be populated is 8 bytes in pos 131.

Code:

//STEP0100 EXEC PGM=ICETOOL     
//TOOLMSG  DD SYSOUT=*         
//DFSMSG   DD SYSOUT=*         
//IN       DD DSN=your 150 byte FB file,DISP=SHR
//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 *                                               
  INREC IFTHEN=(WHEN=INIT,                                     
  OVERLAY=(151:SEQNUM,8,ZD,SEQNUM,3,ZD,START=125,INCR=125,5X)),
  IFTHEN=(WHEN=(159,3,ZD,EQ,0),                               
  OVERLAY=(162:1,5,167:SEQNUM,8,ZD,RESTART=(159,8))),         
  IFTHEN=(WHEN=(159,3,ZD,GT,0),OVERLAY=(159:8C'0'))
           
  OUTFIL FNAMES=T1,IFOUTLEN=167,                               
  IFTHEN=(WHEN=(167,1,CH,GT,C' '),                             
  BUILD=(150X,151,8,ZD,SUB,+3,M11,LENGTH=8,167,8,/,1,159))     
//CTL2CNTL DD *                                               
  SORT FIELDS=(151,8,CH,A),EQUALS                             
  SUM FIELDS=(159,8,ZD)                                       
  OUTFIL FNAMES=OUT,IFOUTLEN=150,                             
  IFTHEN=(WHEN=(159,8,ZD,GT,0),OVERLAY=(131:159,8))           
/*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group