Page 2 of 2

Re: Trying to search a word in the file

PostPosted: Sun Aug 16, 2009 9:52 am
by rajas.abcdefg
may input and output dataset will be in FB format

Re: Trying to search a word in the file

PostPosted: Mon Aug 17, 2009 10:11 pm
by Frank Yaeger
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     

Re: Trying to search a word in the file

PostPosted: Sat Nov 21, 2009 9:55 am
by rajas.abcdefg
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

Re: Trying to search a word in the file

PostPosted: Mon Nov 23, 2009 11:09 pm
by Frank Yaeger
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?)