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

How to find 4 consecutive alphabets in a record in JCL ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
M.RAJAN

New User


Joined: 18 Jul 2005
Posts: 5
Location: chennai

PostPosted: Tue Jun 23, 2009 5:43 am
Reply with quote

Hi All,

I am new to this forum. I have a requirement to extract 4 consecutive alphabets in a record from position 11 to 25 thru JCL. If four consecutive alphabets present in a records that will be written to Outfile1 and rest of the records should be in Outfile2. Please give me idea to proceed.

My input file length is 80 bytes and it is FB format. Below is the sample for my requirement.

Input file.

1234234345RAJAN3007801987TRICHYREC.....
2342424344RAJ234242343RRT3424324243....
1234234345R3007DIYA801987TRICHYREC.....
8759872522LJ3453LK345434LL34KJGJDLDS....

Outfile1.

1234234345RAJAN3007801987TRICHYREC..... - RAJAN has 4 consecutive Alphabet from 11-25 column
1234234345R3007DIYA801987TRICHYREC..... - DIYA has 4 consecutive Alphabet from 11-25 column

Outfile2.
2342424344RAJ234242343RRT3424324243....
8759872522LJ3453LK345434LL34KJGJDLDS....
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 23, 2009 7:11 am
Reply with quote

Quote:
I have a requirement to extract 4 consecutive alphabets in a record from position 11 to 25 thru JCL.
This cannot be done. Repeat after me ... JCL EXECUTES PROGRAMS. It does not extract data, it does not transform data, it does nothing but execute programs.

You could accomplish this via SORT (I believe), or COBOL, or Assembler, or PL/I ... if you could use a program in your JCL.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Jun 23, 2009 8:36 am
Reply with quote

Hi,

here is a possible solution
Code:
//S1       EXEC PGM=ICEMAN                         
//SYSOUT   DD SYSOUT=*                             
//SYMNAMES DD *                                   
CHECK,'ABCDEFGHIJKLMNOPQRSTUVWXYZ'                 
/*                                                 
//SORTIN   DD *                                   
1234234345RAJAN3007801987TRICHYREC.....           
2342424344RAJ234242343RRT3424324243....           
1234234345R3007DIYA801987TRICHYREC.....           
8759872522LJ3453LK345434LL34KJGJDLDS               
/*                                                 
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                         
  OPTION COPY                           
  INCLUDE FORMAT=SS,                   
    COND=(11,1,EQ,CHECK,&,             
          12,1,EQ,CHECK,&,             
          13,1,EQ,CHECK,&,             
          14,1,EQ,CHECK,OR,             
*                                       
          12,1,EQ,CHECK,&,             
          13,1,EQ,CHECK,&,             
          14,1,EQ,CHECK,&,             
          15,1,EQ,CHECK,OR,             
*                                       
          13,1,EQ,CHECK,&,             
          14,1,EQ,CHECK,&,             
          15,1,EQ,CHECK,&,             
          16,1,EQ,CHECK,OR,             
*                                       
          14,1,EQ,CHECK,&,             
          15,1,EQ,CHECK,&,             
          16,1,EQ,CHECK,&,           
          17,1,EQ,CHECK,OR,           
*                                     
          15,1,EQ,CHECK,&,           
          16,1,EQ,CHECK,&,           
          17,1,EQ,CHECK,&,           
          18,1,EQ,CHECK,OR,           
*                                     
          16,1,EQ,CHECK,&,           
          17,1,EQ,CHECK,&,           
          18,1,EQ,CHECK,&,           
          19,1,EQ,CHECK,OR,           
*                                     
          17,1,EQ,CHECK,&,           
          18,1,EQ,CHECK,&,           
          19,1,EQ,CHECK,&,           
          20,1,EQ,CHECK,OR,           
*                                     
          18,1,EQ,CHECK,&,           
          19,1,EQ,CHECK,&,           
          20,1,EQ,CHECK,&,           
          21,1,EQ,CHECK,OR,                   
*                                             
          19,1,EQ,CHECK,&,                     
          20,1,EQ,CHECK,&,                     
          21,1,EQ,CHECK,&,                     
          22,1,EQ,CHECK,OR,                   
*                                             
          20,1,EQ,CHECK,&,                     
          21,1,EQ,CHECK,&,                     
          22,1,EQ,CHECK,&,                     
          23,1,EQ,CHECK,OR,                   
*                                             
          21,1,EQ,CHECK,&,                     
          22,1,EQ,CHECK,&,                     
          23,1,EQ,CHECK,&,                     
          24,1,EQ,CHECK,OR,                   
*                                             
          22,1,EQ,CHECK,&,                     
          23,1,EQ,CHECK,&,                     
          24,1,EQ,CHECK,&,                     
          25,1,EQ,CHECK)                       
/*



Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jun 23, 2009 8:55 pm
Reply with quote

M.RAJAN,

Assuming that by "alphabets", you mean anything other than '0'-'9', you can use a DFSORT job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes. Note that this is easily extendable to checking for more or less than 4 consecutive characters by changing the constant in the OUTFIL INCLUDE operand (e.g. C'111' for 3 characters).

Code:

//S1       EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD DSN=...  input file (FB/80)
//SORTOUT  DD DSN=...  output file (FB/80)
//SYSIN    DD *
  OPTION COPY
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:15C'1')),
    IFTHEN=(WHEN=(11,1,FS,EQ,NUM),OVERLAY=(81:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(12,1,FS,EQ,NUM),OVERLAY=(82:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(13,1,FS,EQ,NUM),OVERLAY=(83:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(14,1,FS,EQ,NUM),OVERLAY=(84:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(15,1,FS,EQ,NUM),OVERLAY=(85:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(16,1,FS,EQ,NUM),OVERLAY=(86:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(17,1,FS,EQ,NUM),OVERLAY=(87:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(18,1,FS,EQ,NUM),OVERLAY=(88:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(19,1,FS,EQ,NUM),OVERLAY=(89:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(20,1,FS,EQ,NUM),OVERLAY=(90:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(21,1,FS,EQ,NUM),OVERLAY=(91:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(22,1,FS,EQ,NUM),OVERLAY=(92:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(23,1,FS,EQ,NUM),OVERLAY=(93:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(24,1,FS,EQ,NUM),OVERLAY=(94:C'0'),HIT=NEXT),
    IFTHEN=(WHEN=(25,1,FS,EQ,NUM),OVERLAY=(95:C'0'))
  OUTFIL INCLUDE=(81,15,SS,EQ,C'1111'),BUILD=(1,80)
/*
Back to top
View user's profile Send private message
M.RAJAN

New User


Joined: 18 Jul 2005
Posts: 5
Location: chennai

PostPosted: Wed Jun 24, 2009 12:13 am
Reply with quote

Hi Frank & Gerry,

I tried these 2 ways. Both are working as expected. Thanks a lot.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
Search our Forums:

Back to Top