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 Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 7 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am


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