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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Where is output from PARM ABEXIT (SNA... packerm CA Products 3 Thu Sep 28, 2017 4:06 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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