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

Find appearance of a particular char in File


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1742
Location: Tirupur, India

PostPosted: Wed Jul 27, 2011 11:37 am
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
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: 1742
Location: Tirupur, India

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

Here,
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top