Posted: Thu Sep 08, 2016 8:16 am Post subject: Split HTML record using tags
Hi,
I am having an input file which is in format of html tags.I would like to split each record from input file after by '</TD>' string. Below given the sample input and required output file details.
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Thu Sep 08, 2016 1:06 pm Post subject: Re: Split HTML record using tags
guhanath wrote:
Require output file:(FB, LRECL=80)
The data length inbetween the tags (<TD><B> and </B></TD>) are varying and its not fixed. Just i would like to break records after '</TD>' string.
Since your input file is 300 bytes and you can have a string for a max length of 291 bytes as <TD></TD> is 9 bytes. So your string can be 300-9=291 bytes.
Code:
<TD>string of 291 bytes</TD> = 300 bytes
So how do you plan to have 291 bytes in an output file of 80 bytes? _________________ Kolusu
www.linkedin.com/in/kolusu
Sorry for confusion. My input file record length is 300 (FB) and each record contains the string '</TD>'. I want to break the record after '</TD>' string.
Suppose one record is having 10 '</TD>' strings, then that record have to split into 10 records based on the string value '</TD>'. The output record length is 80 or 100 or 300 also (FB). I hope in this case the output file length 80 is enough.
As shown in my first post, i just want to break the record after '</TD>' string in a record. The position of '</TD>' string in each record is varying.
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Fri Sep 09, 2016 10:39 am Post subject:
guhanath wrote:
Suppose one record is having 10 '</TD>' strings, then that record have to split into 10 records based on the string value '</TD>'. The output record length is 80 or 100 or 300 also (FB). I hope in this case the output file length 80 is enough.
Guhanath,
I understood the requirement in the first post itself. I just wanted to account for the max string possible. Right now every string of your sample data is less than 80 bytes , but is that true in your real production data?
Assuming you have a string of more than 80 bytes length like this
Code:
<TD><B>string of 120 bytes</B></TD>
And if you want only the first 80 you would get
Code:
<TD><B>string of 76 bytes
without an ending tag </td>
Either way if you just want 80 bytes then here is the JCL to get the desired results.
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Fri Sep 09, 2016 10:46 am Post subject:
t-bonham@scc.net wrote:
I do this frequently with a single SPF Edit command:
Code:
Change "</TD>" "</TD>[cr][lf]"
(You will have to replace the [cd] and [lf] with the hex codes for carriage-return & line-feed in ASCII or EBCDIC, whichever format your file is in.)
t-bonham,
Unless the input file is the ZFS file system, I do not see how a CHANGE Command would split the record into multiple records. After the change you need to FTP the file once again to your self to be able to break down the single record into multiple records.
Secondly since you are inserting 2 new delimiters, your CHANGE command will have trouble adding the new chars if there are NO trailing blanks to account for the additional CRLF bytes you are adding with CHANGE command. _________________ Kolusu
www.linkedin.com/in/kolusu
1. You are having old version of syncsort 2008.
2. Syncsort documentation is not free for all, but since your site is using you should have it.
3. Search for RESIZE, REPEAT, PARSE in your sysncsort manual i.e 2008 manual.
4. if you find the PARSE command in the document then following code might work for you.
5. Note: this code works in dfsort but not sure about syncsort.
Joined: 26 Nov 2002 Posts: 12369 Topics: 75 Location: San Jose
Posted: Sat Sep 10, 2016 12:26 pm Post subject:
guhanath wrote:
Hi Kolusu,
Thanks for your help. I have tried with your code but got RC=12 with below error message.
Your WER messages indicate that you are using Syncsort. DFSORT and Syncsort are competitive products. I'm a DFSORT developer. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort. _________________ Kolusu
www.linkedin.com/in/kolusu
Thanks for coding on SORT. I will check this and post you if any thing either work or not.
@Kolusu,
Thanks. Yes, I can understand the business rules. Any how i will check it in SYNCSORT. If any DFSORT related Queries, defiantly i will post in this forum.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum