Readin data
Moderators: chulett, rschirm, roy
Readin data
Hi
I have a sequential file with 2 columns and delimited by ~ .
If the data in the file is somthingike this
Name~Balance
~~~2000
Are there any ways to read the first 2 ~ into the first column and place the balance amount in the balance column?
I have a sequential file with 2 columns and delimited by ~ .
If the data in the file is somthingike this
Name~Balance
~~~2000
Are there any ways to read the first 2 ~ into the first column and place the balance amount in the balance column?
Declare the file as a long VarChar() or Char() string with no delimiters. Then, in a transform stage, use function such as DCOUNT() and FIELD() to parse the string into the 2 components you wish.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Yes, but you need to handle this in your transform. With DCOUNT(In.String,'~') you find out how many tilde you have, then with FIELD(In.String,'~',nnn) you can pick out field nnn from the string. The rest is up to you and your business logic.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Swerajan:Did you get the solution?
Arnd:Even if I count no. of tildes,FIELD function looks into delimeter,how can I distinguish starting two tildes with actual delimeter '~'?Could not see complete post because of premium member constraints.
Arnd:Even if I count no. of tildes,FIELD function looks into delimeter,how can I distinguish starting two tildes with actual delimeter '~'?Could not see complete post because of premium member constraints.
Kiran Vaduguri
As soon as the fear approaches near, attack and destroy it.
As soon as the fear approaches near, attack and destroy it.
-
- Participant
- Posts: 251
- Joined: Mon Jun 09, 2008 5:52 am
-
- Participant
- Posts: 251
- Joined: Mon Jun 09, 2008 5:52 am
Actually, more like:
Code: Select all
FIELD(In.String,'~',1,DCOUNT(In.String,'~')-1) -->name clumn
FIELD(In.String,'~',DCOUNT(In.String,'~')) --->balance column
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>