Trying to search a word in the file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Re: Trying to search a word in the file

Postby rajas.abcdefg » Sun Aug 16, 2009 9:52 am

may input and output dataset will be in FB format
rajas.abcdefg
 
Posts: 38
Joined: Thu Jul 09, 2009 8:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Re: Trying to search a word in the file

 

Re: Trying to search a word in the file

Postby Frank Yaeger » Mon Aug 17, 2009 10:11 pm

Here's a DFSORT job that will do what you asked for:

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/150)
//SORTOUT DD DSN=...  output file (FB/150)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,150,SS,EQ,C'IN'),
    OVERLAY=(151:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(1,150,SS,EQ,C'REPORT'),OVERLAY=(151:SEQNUM,8,ZD)),
   IFTHEN=(WHEN=(1,150,SS,EQ,C'OUTPUT'),OVERLAY=(151:SEQNUM,8,ZD))
  OUTFIL INCLUDE=(151,8,ZD,EQ,1),BUILD=(1,150)
/*


For your input example, SORTOUT would have:

sakfhhsfa IN54434                     
askhdfhsaf REPORT ashf444             
ioweuqr237869450 OUTPUT6879777977     
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: Trying to search a word in the file

Postby rajas.abcdefg » Sat Nov 21, 2009 9:55 am

Hi Frank,

I have a dataset of variable record length with records in the format of

Jos#Frank#John#Robert#<space or junk>
Ponting#Williams#JWarne#Gilchrist#<space or junk>
1234#asdf#8956#<space or junk>

I just want to remove only the last # and replace the remianing after last # with space.

Will this be possible with a sort card
rajas.abcdefg
 
Posts: 38
Joined: Thu Jul 09, 2009 8:56 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Trying to search a word in the file

Postby Frank Yaeger » Mon Nov 23, 2009 11:09 pm

Please start a new topic for this new question rather then adding it to an unrelated topic.

In your new topic, give more information:

- Give the RECFM and LRECL of the input file
- Show a better input example with the record length for each input record, and real values for <space or junk>
- Show the expected output for your input example with the record length for each output record
- What is the maximum number of fields in a record (your example has a maximum of 5 fields - is that really the maximum?)
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Previous

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post