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

Search for a character and output the record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
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 Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top