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
 

 

Find appearance of a particular char in File

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

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Jul 27, 2011 10:16 am    Post subject: Find appearance of a particular char in File
Reply with quote

Hi,

I have a requirement to read a variable length file with each field delimited by "#". My requirement is to write 10 character to output file appearing after 6th occurence of "#".

Need help. Thanks

Regards
manoj
Back to top
View user's profile Send private message

vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1456
Location: Azeroth

PostPosted: Wed Jul 27, 2011 11:37 am    Post subject:
Reply with quote

Hello,
Show us the some sample data of the input and required output record layout & LRECL.
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Jul 27, 2011 11:53 am    Post subject: Reply to: Find appearance of a particular char in File
Reply with quote

01#222#4444#5555#555#66#ABCDEFGHIJ#123123#
002#335555#555#66666#99999#99999#PPPPPPPPPQ#345345


I want the 10 characters appearing after 6th apperance of # ie

ABCDEFGHIJ
PPPPPPPPPQ
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1456
Location: Azeroth

PostPosted: Wed Jul 27, 2011 12:01 pm    Post subject:
Reply with quote

Here,
http://ibmmainframes.com/archive/o_t__t_55402__start_0__index.html
Back to top
View user's profile Send private message
puneetvirmani143

New User


Joined: 24 Jul 2007
Posts: 55
Location: noida

PostPosted: Wed Jul 27, 2011 12:57 pm    Post subject: Reply to: Find appearance of a particular char in File
Reply with quote

Hi,

The above solution will work when we know the length of each field.

For my case i do not know the length of each data appearing between 2 '#'.

I only know that i have to pick 10 characters appearing after 6th '#'
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 27, 2011 1:05 pm    Post subject:
Reply with quote

puneetvirmani143 wrote:
Hi,

The above solution will work when we know the length of each field.

For my case i do not know the length of each data appearing between 2 '#'.

I only know that i have to pick 10 characters appearing after 6th '#'


puneetvirmani143,

what you have said is wrong.

i suggest you read about the parse function.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Wed Jul 27, 2011 1:31 pm    Post subject: Reply to: Find appearance of a particular char in File
Reply with quote

Hi,

I have taken the above link as an example and tried the below sort card.
Can you please check if it suits your requirement.

Code:

  OPTION COPY                     
  OUTREC PARSE=(%=(ENDBEFR=C'#'), 
            %=(ENDBEFR=C'#'),   
            %=(ENDBEFR=C'#'),   
            %=(ENDBEFR=C'#'),   
            %=(ENDBEFR=C'#'),   
            %=(ENDBEFR=C'#'),   
            %06=(FIXLEN=10)),   
   BUILD=(%06)                   
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 27, 2011 2:24 pm    Post subject:
Reply with quote

surya anem,

excellent,
your sort control cards will indeed provide the 10 chars following the 6th occurance of #,

but in case the TS has mistated his problem, and he only wants the characters between the 6th and 7th #, with a max length of 10

this control card will work:

%06=(ENDBEFR=C'#',FIXLEN=10)),

either way, hats off to you for the solution,
which the ts could not manage on his own.
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm


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