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: 1491
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: 1491
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: 6967
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: 6967
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


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