Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

PARSE question re: ABSPOS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: PARSE question re: ABSPOS
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Sun Jul 27, 2014 12:54 pm    Post subject: Reply to: PARSE question re: ABSPOS
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    Post subject: Reply to: PARSE question re: ABSPOS
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts XML Parse for large file muralikrishnan_new COBOL Programming 3 Mon Jun 12, 2017 12:50 pm
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts The Last Two Question For You To Ask ... CaptBill Mainframe Interview Questions 0 Fri Apr 14, 2017 5:42 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us