Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 1541
Location: Chennai

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: 1541
Location: Chennai

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: 6970
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: 6970
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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us