Hello
I am new to the Alteryx community and wondered if anyone has an idea on how to parse the attached file? Below is the file layout. So far in my workflow i have been able to upload the file but I am having difficulty parsing the file and producing the required field names. Any help would be great.
OFFSET FIELD NAME LENGTH DATA DEFINITION
001 – 015 Account 15 PIC 9(15)
16 Filler 1 PIC X. Value Null.
017 – 026 Location 10 PIC 9(10) (ULID)
27 Filler 1 PIC X Value Null.
028 – 031 Return Date (MMDD) 4 PIC 9(4)
32 Filler 1 PIC X Value Null.
033 – 036 Date (MMDD) 4 PIC 9(4)
37 Filler 1 PIC X Value Null.
038 – 046 Transit Number 9 PIC 9(9)
47 Filler 1 PIC X Value Null.
048 – 062 Account Number 15 PIC 9(15)
63 Filler 1 PIC X Value Null.
064 – 073 Serial Number 10 PIC 9(10)
74 Filler 1 PIC X Value Null.
075 – 084 Amount ($$$$$$$$cc) 10 PIC 9(8)V99
85 Filler 1 PIC X Value Null.
086 – 087 Return Reason 2 PIC XX
88 Filler 1 PIC X Value Null.
089 – 128 Maker Name 40 PIC X(40) (Left Justify, Blank Fill)
129 Filler 1 PIC Value Null.
130 Disposition Indicator 1 PIC X
Solved! Go to Solution.
Hello @anom23,
Could you give a little bit more info in how the input that you want to parse look like and your desired output.
In the text file attached the layout looks very different than the file layout you posted in the comment above.
If you could give an example workflow, or an input file on what to parse I can try to help you.
//Best Regards
Elias
I love regex parsing and you can do what you are asking with a regex tool set to parse mode with (.{15))/s(.{10})/s - etc... or you can bring it as plain undelimited text and then cut it apart using /s as the delimiter and 10 columns.
Hi Elias
Sure....when I use the dynamic text input filed my column looks like below. I am not sure if that helps or not, but the file was provided by another source.
So I was able to use this regex expression for the below file structure - (\d{15})(\d{10})(\d{4})(\d{4})(\d{8})(\d{15})(\d{10})(\d{10})(\d{2})\s+([C|R])
Old FIle - 000000300004200 0000000000 0821 0814 01110309 000004333292376 0000995504 0000000800 08 C
Which worked until I was provided with a new file structure that contains letters
New File - 000000324444587 0000000000 0821 0814 01110309 000004333292376 0000995504 0000000800 08 MAKER INFO FOR 323800007 C
I attempted to use this expression but it does not parse - (\d{15})(\d{10})(\d{4})(\d{4})(\d{9})(\d{15})(\d{10})(\d{10})(\d{2})(\d{40})\s+([C|R])
Can anyone provide some insight at what I might be doing incorrectly?
Try swapping the second to last \d{10} with \w{10} (if that doesn't work swap a bunch/all of the \d's with \w's)
If this is going to happen with other sections you need clarity on what the potential values are going to be fed into the parse. There's a lot of hardcoded regex in your parse tool and it's only for digits right now. Also - it should end with a $ to clarify that you want the C/R as the last character.