View previous topic :: View next topic
|
Author |
Message |
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
Show us the some sample data of the input and required output record layout & LRECL. |
|
Back to top |
|
|
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
Back to top |
|
|
puneetvirmani143
New User
Joined: 24 Jul 2007 Posts: 55 Location: noida
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
|