Can you loop on a single file with SSIS? - sql

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

Related

How to call one line at a time in LabVIEW read text file?

I would like to read just one line of text at a time using "Read from text file" function. After the passing of this line I would like to move on to the next line after the rest of the program iterates once. When I change the "Read from text file" function to "Read lines", I can no longer put an indicator on the front panel for text. How can I iterate one line at a time? How can I put an indicator on the front panel to display which line of text was read?
This what you want:
Open/Create/Replace File (with inputs open and read-only)
— inside While Loop:
Read From Text File (with Read Lines)
End While Loop on error from Read From Text File
--After While Loop:
Close File
You can process the data in the While loop, or index it and process outside.
Read the Text file
Use for loop, and add the shift register to it
Through the input shift register terminal, wire the text file output (Initial data)
In Front panel, Right Click >> String >> Additional String Function >> Search/Split String
Wire the Initial data (from shift register) to the input string terminal and Provide the necessary search string/ Character (In my case, I have used line feed constant)
Search/Split String has two output terminals; Substring before the match and match +rest of the String
Trime the whitespace and wire the match +rest of the String o/p to the o/p shift register; Take the desired o/p from Substring before the match terminal
Set the tunnel mode of the desired string as indexing so that each line in the file is indexed to an element in the array.
Note: N value of the for loop's iteration terminal is equal to the no of lines in the file.

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, "") )

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.

write new line to file

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.