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
 

 

sort untill a perticular character, if found then write it

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
maxsubrat

New User


Joined: 27 Feb 2008
Posts: 75
Location: india

PostPosted: Mon Jun 20, 2011 3:19 pm    Post subject: sort untill a perticular character, if found then write it
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Mon Jun 20, 2011 4:10 pm    Post subject: Reply to: sort untill a perticular character, if found then
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: 578
Location: USA

PostPosted: Mon Jun 20, 2011 6:38 pm    Post subject:
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    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 Record Not found in AlX but record re... mukun264 COBOL Programming 5 Fri Mar 24, 2017 9:28 am
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm


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