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 

Check for consecutive alphabets in a string

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
nbdtrjk1
Beginner


Joined: 12 Apr 2007
Posts: 76
Topics: 41

PostPosted: Mon Jun 22, 2009 11:20 pm    Post subject: Check for consecutive alphabets in a string Reply with quote

I have a file with LRECL=80,RECFM=FB with multiple fields. I need to filter out the records which have 4 consecutive alphabets ( in general , n consecutive alphabets ) in the position of 1 to 25.

Please suggest me how to achieve using sort card
Back to top
View user's profile Send private message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Tue Jun 23, 2009 6:45 am    Post subject: Reply with quote

This can be achieved using Fileaid. Check the following code. I have included conditions only to check for 'ABCD', 'BCDE', 'CDEF' & 'DEFG' for this example. You can include the next set of consecutive letters for your requirement.

Code:
//STEP01  EXEC PGM=FILEAID                             
//SYSPRINT DD SYSOUT=*                                 
//SYSLIST  DD SYSOUT=*                                 
//DD01     DD *                                       
ABCDKSDFJSLDJFS JJ                                     
GHLKHKCDEF                                             
DEA LKJLKJL                                           
/*                                                     
//DD01O    DD SYSOUT=*                                 
//SYSIN    DD *                                       
$$DD01 COPY IF=(1,25,C'ABCD',C'BCDE',C'CDEF',C'DEFG') 
/*                                                     



This will output the following records as o/p.

Code:
ABCDKSDFJSLDJFS JJ                                     
GHLKHKCDEF


Let me if it works.

Thanks,
Ram
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 23, 2009 10:58 am    Post subject: Reply with quote

nbdtrjk1,

The following JCL will give you the desired results.


Code:

//STEP0100 EXEC PGM=SORT           
//SYSOUT   DD SYSOUT=*             
//SYMNAMES DD *                     
ALP,C'ABCDEFGHIJKLMNOPQRSTUVWXYZ'   
//SORTIN   DD DSN=your input 80 bytes,DISP=SHR
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                   
  SORT FIELDS=COPY                                                 
  INCLUDE FORMAT=SS,                                               
  COND=((11,1,EQ,ALP,&,12,1,EQ,ALP,&,13,1,EQ,ALP,&,14,1,EQ,ALP),OR,
        (12,1,EQ,ALP,&,13,1,EQ,ALP,&,14,1,EQ,ALP,&,15,1,EQ,ALP),OR,
        (13,1,EQ,ALP,&,14,1,EQ,ALP,&,15,1,EQ,ALP,&,16,1,EQ,ALP),OR,
        (14,1,EQ,ALP,&,15,1,EQ,ALP,&,16,1,EQ,ALP,&,17,1,EQ,ALP),OR,
        (15,1,EQ,ALP,&,16,1,EQ,ALP,&,17,1,EQ,ALP,&,18,1,EQ,ALP),OR,
        (16,1,EQ,ALP,&,17,1,EQ,ALP,&,18,1,EQ,ALP,&,19,1,EQ,ALP),OR,
        (17,1,EQ,ALP,&,18,1,EQ,ALP,&,19,1,EQ,ALP,&,20,1,EQ,ALP),OR,
        (18,1,EQ,ALP,&,19,1,EQ,ALP,&,20,1,EQ,ALP,&,21,1,EQ,ALP),OR,
        (19,1,EQ,ALP,&,20,1,EQ,ALP,&,21,1,EQ,ALP,&,22,1,EQ,ALP),OR,
        (20,1,EQ,ALP,&,21,1,EQ,ALP,&,22,1,EQ,ALP,&,23,1,EQ,ALP),OR,
        (21,1,EQ,ALP,&,22,1,EQ,ALP,&,23,1,EQ,ALP,&,24,1,EQ,ALP),OR,
        (22,1,EQ,ALP,&,23,1,EQ,ALP,&,24,1,EQ,ALP,&,25,1,EQ,ALP))   
//*

_________________
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 -> Job Control Language(JCL) 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