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 How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts JES2 doesn't honor the priority of th... Aron Lendvai JCL & VSAM 7 Thu Jun 29, 2017 1:41 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
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 Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am


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