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 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 find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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