IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PARSE question re: ABSPOS


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
David Sde

New User


Joined: 24 Apr 2011
Posts: 23
Location: USA

PostPosted: Sun Jul 27, 2014 10:09 am
Reply with quote

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:
Code:

AAA      BB       C                                       
DD       E        FFFF                                   

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sun Jul 27, 2014 12:54 pm
Reply with quote

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
View user's profile Send private message
David Sde

New User


Joined: 24 Apr 2011
Posts: 23
Location: USA

PostPosted: Sun Jul 27, 2014 4:49 pm
Reply with quote

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
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Question regarding ISPF tables with T... TSO/ISPF 11
No new posts Denomination counts by using PARSE in... DFSORT/ICETOOL 8
No new posts OPC scheduling question IBM Tools 0
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Question for file manager IBM Tools 7
Search our Forums:


Back to Top