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 

Get subsequent record with some condition.

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


Joined: 11 Dec 2006
Posts: 6
Topics: 2

PostPosted: Fri Nov 02, 2007 9:33 am    Post subject: Get subsequent record with some condition. Reply with quote

Searched in the earlier posted, but couldnt find similar kind of stuff, Anyone please help me.

I have to reterive all the records which the App_CD '54' followed by '61'.
App_No - 1 to 4 byte and App_CD is 5 to 2 byte.

for eg:
Code:

App_No App_CD
1112   54
1234   54
1234   61
1118   72
1235   70
1235   61
1119   54
1238   54
1238   61

The output shuold be:
Code:

App_No App_CD
1234   54
1234   61
1238   54
1238   61

Shall we do Syncsort, since my shop we have SYNCSORT latest version, or any sort we can do?
Appriciate your help

Thanks
Savi.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Nov 02, 2007 11:19 am    Post subject: Reply with quote

savi.sabari
This ICETOOL/SYNCTOOL JCL should work for your requirement.
Code:
//***krisprems*******************************               
//STEP001  EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN1      DD *                                                         
1112   54                                                               
1234   54                                                               
1234   61                                                               
1118   72                                                               
1235   70                                                               
1235   61                                                               
1119   54                                                               
1238   54                                                               
1238   61                                                               
/*                                                                     
/*                                                                     
//TMP1     DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA 
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
 COPY FROM(IN1)  TO(TMP1) USING(CP01)                                   
 SPLICE FROM(TMP1) TO(OUT) ON(81,8,ZD) WITH(25,20) -                   
                       WITHEACH USING(CP02)                             
/*                                                                     
//CP01CNTL DD   *                                                       
  OUTFIL BUILD=(1,20,81:SEQNUM,8,ZD,/,                                 
                25:1,20,81:SEQNUM,8,ZD,START=0)                         
/*                                                                     
//CP02CNTL DD   *                                                       
  OUTFIL FNAMES=OUT,INCLUDE=(8,2,CH,EQ,C'54',&,                         
                             32,2,CH,EQ,C'61'),                         
                      BUILD=(1,20,80:X,/,25,20)                         
/*                                                                     

OUT contains:
Code:
1234   54
1234   61
1238   54
1238   61

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
savi.sabari
Beginner


Joined: 11 Dec 2006
Posts: 6
Topics: 2

PostPosted: Fri Nov 02, 2007 11:26 am    Post subject: Reply with quote

Thanks Krish, Now our system is down, will try and bug you once it up.
Back to top
View user's profile Send private message
krisprems
Beginner


Joined: 13 Dec 2006
Posts: 101
Topics: 4
Location: india

PostPosted: Fri Nov 02, 2007 12:17 pm    Post subject: Reply with quote

Quote:

BUILD=(1,20,80:X,/,25,20)

Change this build statement to
Quote:

BUILD=(1,20,80:X,/,25,20,80:X)

_________________
cHEERs
krisprems
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Mon Nov 05, 2007 10:56 am    Post subject: Reply with quote

savi.sabari,

Here is an untested 1 step DFSORT's ICETOOL job which would give you the desired results

Code:

//STEP0100 EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN        DD *                                                         
1112   54                                                               
1234   54                                                               
1234   61                                                               
1118   72                                                               
1235   70                                                               
1235   61                                                               
1119   54                                                               
1238   54                                                               
1238   61                                                               
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
  SELECT FROM(IN)  TO(OUT) ON(81,8,ZD) ALLDUPS USING(CTL1)
/*                                                                     
//CTL1CNTL DD   *                                                       
  INCLUDE COND=(8,2,SS,EQ,C'54,61')
  INREC IFTHEN=(WHEN=INIT,
       OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(8,2,CH,EQ,C'54'),
       OVERLAY=(81:+1,ADD,81,8,ZD,M10,LENGTH=8))
 
  OUTFIL FNAMES=OUT,OUTREC=(01,80)
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Tue Nov 13, 2007 11:39 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Mon Nov 05, 2007 11:15 pm    Post subject: Reply with quote

The second IFTHEN condition should include WHEN.
Code:
//CTL1CNTL DD   *                           
  INCLUDE COND=(8,2,SS,EQ,C'54,61')         
  INREC IFTHEN=(WHEN=INIT,                 
       OVERLAY=(81:SEQNUM,8,ZD)),           
        IFTHEN=(WHEN=(8,2,CH,EQ,C'54'),     
       OVERLAY=(81:+1,ADD,81,8,ZD,LENGTH=8))
                                           
  OUTFIL FNAMES=OUT,OUTREC=(01,80)         
/*                                         
Back to top
View user's profile Send private message Send e-mail
savi.sabari
Beginner


Joined: 11 Dec 2006
Posts: 6
Topics: 2

PostPosted: Fri Nov 09, 2007 2:10 pm    Post subject: Reply with quote

Thank you very much for your support and Belated Diwali wishes to every one...
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Nov 13, 2007 12:51 pm    Post subject: Reply with quote

Vkphani,

Thanks for the correction, but you also would need M10 edit mask also. I have updated my post with the right control cards

Code:

//CTL1CNTL DD   *                                                       
  INCLUDE COND=(8,2,SS,EQ,C'54,61')
  INREC IFTHEN=(WHEN=INIT,
       OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(8,2,CH,EQ,C'54'),
       OVERLAY=(81:+1,ADD,81,8,ZD,M10,LENGTH=8))
 
  OUTFIL FNAMES=OUT,OUTREC=(01,80)
/*

_________________
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