IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sort untill a perticular character, if found then write it


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Mon Jun 20, 2011 3:19 pm
Reply with quote

SORT a input file until some character found. suppose my input redcord is like that:

001 3456 bs road newdelhi 4000 pepsi 50000 77777 858585

Please see the above record.. and search the input record, if found the word pepsi in the input record, then write the record until pepsi to the output file. My output file would be:

001 3456 bs road newdelhi 4000 pepsi


like this we need to sort out our files. Record length is 100 and it is fixed.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 20, 2011 4:10 pm
Reply with quote

I don't think you've fully describe what you want yet.

Do you need to find a particular character in a fixed position? Or what?

Then search that record for "pepsi"? Is it only "pepsi"?

Then chop off the record after "pepsi"?

And only write to the output file those shortened "pepsi" records?
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Mon Jun 20, 2011 6:38 pm
Reply with quote

maxsubrat,
maxsubrat wrote:
SORT a input file until some character found. suppose my input redcord is like that:

001 3456 bs road newdelhi 4000 pepsi 50000 77777 858585

Please see the above record.. and search the input record, if found the word pepsi in the input record, then write the record until pepsi to the output file.
...
Record length is 100 and it is fixed.

I don't see SORTing requirement here. However, what if the word 'pepsi' occurs twice (or more than that) in the input record, do you want to select part of record until first occurrence? Also, what if the word 'pepsi' is not at all present in the input record?

I am not sure if below is exactly what you asked for but see if it works for you...If this is not what you want, please explain the rules in detail.
Code:

//STEP0001 EXEC PGM=SORT                                 
//SORTIN   DD  *       /* YOUT INPUT FILE GOES HERE                                 
001 3456 BS ROAD NEWDELHI 4000 PEPSI 50000 77777 858585 
001 3456 BS ROAD NEWDELHI 4000 COKE  50000 77777 858585 
/*                                                       
//SORTOUT  DD  SYSOUT=*                                 
//SYSIN DD *                                             
  INCLUDE COND=(1,100,SS,EQ,C'PEPSI')                     
  INREC IFTHEN=(WHEN=INIT,                               
        PARSE=(%01=(ENDAT=C'PEPSI',FIXLEN=100)),         
               BUILD=(%01))                             
   SORT FIELDS=COPY                                     
/*                                                       
//SYSOUT DD SYSOUT=*                                     
//*                                                     

OUTPUT-ASSUMING 100 BYTE
Code:

001 3456 BS ROAD NEWDELHI 4000 PEPSI

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top