write new line to file - abap

I'm trying to write to file newline. I'm using WS_DOWNLOAD but have no idea how to write new line into text.
Anyone knows ?

Set a character type field to cl_abap_char_utilities=>cr_lf and insert that in the appropriate places (wherever you want a new line) to your output.
This contains the carriage return & linefeed characters.

Related

How to prevent line feeds (vbLf) and carriage returns (vbCr) in text boxes in a vb.net text file?

How to prevent line feeds (vbLf) and carriage returns (vbCr) in a text box that should only be one line, in a text file? It can happen that these carriage return characters and these new line characters are present (for example during a copy and paste) in the body of the text and thus make the reading of the file impossible. This has happened to me before, and I think I need to set up a check for the presence of these characters and thus warn the user to check his line before any recording. Thank you in advance. Claude.
Replace the CR and LF with nothing?
textBoxWithCrLf.Text.Replace(vbCr, "").Replace(vbLf, "")
Note, this doesn't modify the contents of the textbox, it generates a new string with no CRLF, so you'd use it like:
somefilewriter.SomeWriteStringMethod( textBoxWithCrLf.Text.Replace(vbCr, "").Replace(vbLf, "") )

Can you loop on a single file with SSIS?

I have a EBCDIC (Mainframe) VSAM file without any carriage return. It is like a million characters long.
With SSIS, could I loop on the file's single line and add a carriage return each time I hit the SIN of the first record type? (record control type starts with 90)
I have not found any doc on this particular function or if it is possible at all.
I'm not familiar with VSAM or what the SIN token is but you should be able to use a normal flatfile connection but change the new line identifier from carriage return to the SIN. The default end of line token is "{CR}{LF}"
The flat file connection would then treat the SIN's as carriage returns and align your file accordingly
Here is my "VSAM" file with SIN as the carriage return token
Create a flatfile source and set the column header row delimiter token to SIN
Next set the row delimiter to SIN
Hit refresh columns to align everything

Finding occuramce of a string in a column in excel based text file

I am using vb.net to find the sum of occuramce of string in a particular column in text file(excel based) . The text file is not tab delimited, and it is separated column by column nicely, I only learnt how to read line by line using stream reader but I have no idea how to read only the last column of the line and summing up the specific string that I want. Any idea how to do it? Not nesseccary nid to provide me the code
If by "an Excel-based text file" you mean that the values are comma-separated, you can read it in line by line, like you already are doing using a stream, and then use Split to separate the line out into an array. Google "vb.net split" to learn how to do this.

Sed/Awk:How to remove Ctrl z characters at the last line, replace new line characters in between records to space

I have a requirement where I need to perform following 3 things to a file in Linux:
Check if Ctrl-z character is present at the last line of the file and if present then delete the line.
Replace new line characters that appear in between the fields in all the records to a single space but it should not replace the last new line in every record which signifies record delimiter.
Delete the first line of the file.
I can not use any script.Can it be done with sed/awk. Any suggestion is highly appreciated.

Visual Basic pulling a character from a certain line number

I am working on a macro that needs to be able to check and make sure that a character on a certain line is what it should be before it finishes the form.
Where or how do i find the information to do this?
I have tried using the command "Left(#of line ,1)" and am not getting it to return anything at this point.
I Assume that you have this text in a string. Comment to my answer if wrong.
You can use a Regex to compare to string with your character like so :
If Regex.IsMatch(MyString, *.{X}Y) Then
'You have to manually replace X for the number of characters before the character you scan for
'You have to manually replace Y for the-said character it is supposed to be
Look at http://www.codeproject.com/Articles/9099/The-Minute-Regex-Tutorial for more info on Regex.
If you want to only take one line in your string :
TheLine = split(MyString,Environnement.Newline)([Line Number])