|
View previous topic :: View next topic
|
| Author |
Message |
David Sde
New User
Joined: 24 Apr 2011 Posts: 23 Location: USA
|
|
|
|
I hope someone can show me the error of my ways...
I'm using INREC PARSE to parse a VB pipe-delimited dataset. My goal is to produce a VB output file in which the first few output fields are the parsed fields, followed by the original pipe-delimited record.
E.g., if the input file is LRECL=30 and consists of these two records:
| Code: |
AAA|BB|C|
DD|E|FFFF| |
Then I would like the output records to be:
| Code: |
AAA BB C AAA|BB|C|
DD E FFFF DD|E|FFFF| |
My control statements are:
| Code: |
OPTION COPY
INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=9),
%02=(ENDBEFR=C'|',FIXLEN=9),
%03=(ENDBEFR=C'|',FIXLEN=9),
%99=(ABSPOS=5,FIXLEN=30)),
BUILD=(1,4,%01,%02,%03,%99) |
But my output file reads:
I had thought that by specifying ABSPOS=5, that I would be setting the parse pointer back to column 5 (i.e., the start of the data in the original VB record), and therefore %99 would contain 30 bytes starting at that position (which would be the original pipe-delimited record). But I'm getting blanks in those columns. I've obviously misunderstood something... can anyone help?
Thanks so much,
David |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
I'd go with:
| Code: |
| BUILD=(1,4,%01,%02,%03,5) |
That single 5 at the end will say "from position five of the current record to the end of the current record" which should give you what you want. |
|
| Back to top |
|
 |
David Sde
New User
Joined: 24 Apr 2011 Posts: 23 Location: USA
|
|
|
|
Bill,
That worked perfectly; thank you! It's also much more straightforward than my approach.
If anyone has time, I'm curious to know where I went wrong in my approach re: ABSPOS (i.e., I love to know why my solution produced blanks instead of the original pipe-delimited record).
Thanks,
David |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|