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

Search all records and copy string only.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Tue Feb 24, 2009 3:05 pm
Reply with quote

Hi,

I have an input file as given below with LRECL of 90 & RECFM of FB.

Requirement: Whenever there is a 6 digit number found in front of FIRM that content (10 characters) should be moved to the 1st position of output file. The Xs shown below actually contains some alphanumeric data and it is not constant value.

Sample Records:
Code:

PC2009-02-23XXXXXXXXXX291712FIRM
PC2008-07-11185980FIRMXXXXXXXXXX
PC2008-07-21XX581460FIRMXXXXXXXX
PC2008-07-22XX881360TRIMXXXXXXXX
PC2008-07-15XXXXX964785FIRMXXXXX
PC2008-07-16XXXX562780TERMXXXXXX
PC2008-07-30X056402FIRMXXXXXXXXX


Expected Output:
Code:

291712FIRMPC2009-02-23XXXXXXXXXX
185980FIRMPC2008-07-11XXXXXXXXXX
581460FIRMPC2008-07-21XXXXXXXXXX
964785FIRMPC2008-07-15XXXXXXXXXX
056402FIRMPC2008-07-30XXXXXXXXXX


Please help.

Thanks.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Feb 24, 2009 10:00 pm
Reply with quote

Ramsri,

Here are SORT control statements that should produce your requested output:
Code:

//SYSIN  DD *                                                 
  INREC PARSE=(%01=(ABSPOS=1,FIXLEN=12),                       
               %02=(ENDAT=C'FIRM',FIXLEN=20),                   
               %03=(FIXLEN=20)),                               
        BUILD=(1:%01,                                           
              13:%02,JFY=(SHIFT=RIGHT),                         
              33:%03,JFY=(SHIFT=LEFT))     
  SORT FIELDS=COPY                     
  OUTFIL INCLUDE=(29,4,CH,EQ,C'FIRM',AND,23,6,ZD,EQ,NUM),       
         IFTHEN=(WHEN=INIT,BUILD=(23,6,29,4,1,12,13,10,33,10)),
         IFTHEN=(WHEN=INIT,                                     
                 BUILD=(1,22,23,20,SQZ=(SHIFT=LEFT,LENGTH=10)))
/*

However, since your file is FB/90, you may need to modify the the field lengths/positions based on your actual data. This example is based solely on the sample records you provided.
Back to top
View user's profile Send private message
ramsri

Active User


Joined: 18 Oct 2008
Posts: 380
Location: India

PostPosted: Wed Feb 25, 2009 8:32 pm
Reply with quote

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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
Search our Forums:

Back to Top