Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Search all records and copy string only.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Search all records and copy string only.
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: 500
Location: USA

PostPosted: Tue Feb 24, 2009 10:00 pm    Post subject:
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    Post subject: Reply to: Search all records and copy string only.
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us