Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Search for a character and output the record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Tue Apr 07, 2009 12:43 pm    Post subject: Search for a character and output the record
Reply with quote

Hi,

I have a file of LRECL 70. My requirement is to find the Binary number X'0004' and write the next 6 byte packed decimal into the output. the character x'0004' can appear in any place between positions 1 and 64.
For example:
Input file:
Code:

----+----1----+----2----+----3----+----4----+----5----+----6----+----7
                                                                     
0000000144444444444400000002444444444444444400000003444444444444444444
0400000C0000000000000400000C00000000000000000400000C000000000000000000
----------------------------------------------------------------------
               <           *                            %             
0000000100000004444400000005444444444444444444444000000064444444444444
0400000C0400000C00000400000C0000000000000000000000400000C0000000000000


Output expected:

Code:

0004 00000000001
0004 00000000002
0004 00000000003
0004 00000000004
0004 00000000005
0004 00000000006


Is there any way that we could achieve it with sort.

Thanks.
Regards,
Ram.
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Apr 07, 2009 9:55 pm    Post subject: Reply to: Search for a character and output the record
Reply with quote

The following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                               
//TOOLMSG  DD SYSOUT=*                                     
//DFSMSG   DD SYSOUT=*                                     
//IN       DD DSN=Your input 70 byte file,
//            DISP=SHR
//T1       DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT      DD SYSOUT=*                                     
//TOOLIN   DD *                                           
  COPY FROM(IN) USING(CTL1)                               
  SORT FROM(T1) USING(CTL2)                               
//CTL1CNTL DD *                                           
  OUTFIL FNAMES=T1,                                       
  PARSE(%01=(STARTAFT=X'0004',FIXLEN=6),                   
        %02=(STARTAFT=X'0004',FIXLEN=6),                   
        %03=(STARTAFT=X'0004',FIXLEN=6),                   
        %04=(STARTAFT=X'0004',FIXLEN=6),                   
        %05=(STARTAFT=X'0004',FIXLEN=6),                   
        %06=(STARTAFT=X'0004',FIXLEN=6),                   
        %07=(STARTAFT=X'0004',FIXLEN=6),                   
        %08=(STARTAFT=X'0004',FIXLEN=6)),                 
  BUILD=(C'0004 ',%01,/,C'0004 ',%02,/,                   
         C'0004 ',%03,/,C'0004 ',%04,/,                   
         C'0004 ',%05,/,C'0004 ',%06,/,                   
         C'0004 ',%07,/,C'0004 ',%08)                     
//CTL2CNTL DD *                                           
  OMIT COND=(6,1,CH,EQ,C' ')                               
  SORT FIELDS=(1,5,CH,A,6,6,PD,A)                         
  SUM FIELDS=NONE                                         
  OUTFIL FNAMES=OUT,BUILD=(1,5,6,6,PD,M11,LENGTH=12)       
/*
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts VSAM - Accessing beyond record size Benchwarmer JCL & VSAM 6 Wed Apr 11, 2018 9:20 pm
No new posts Invalid XML character while producing... nikhil.bhole IBM Tools 4 Tue Mar 20, 2018 1:24 am
No new posts How to get the output from submit com... Joanna2016 CLIST & REXX 10 Tue Feb 06, 2018 7:26 am
No new posts Copying only first and last word from... chandan.inst SYNCSORT 4 Wed Jan 31, 2018 4:19 pm
No new posts How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us