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

OMIT first and last column of a pipe-delimited VB file


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

New User


Joined: 01 Nov 2019
Posts: 1
Location: United States of America

PostPosted: Fri Nov 01, 2019 8:24 pm
Reply with quote

I have requirement wherein I have to exclude the first and last column of a pipe-delimited VB file. The position of the first and last column is not fixed, it can vary from one record to the other. The file is RECFM=VB and LRECL=2000

I thought of using the below SORT card to exclude the first and last column:
OUTREC PARSE=(%=(ENDBEFR=C'|'),
%01=(ENDBEFR=C'|',FIXLEN=10),
%72=(ENDBEFR=C'|',FIXLEN=20),
%=(FIXLEN=35)),
BUILD=(1,4, * RDW
%01 and so on)

But the problem with this is that I have to give FIXLEN to each field I declare in the PARSE which I don't want to as it will add trailing spaces towards the end of each column. As each column can contain spaces in between also, so removing only the trailing spaces through SQZ wouldn't be an option.

The sample input data is below:
First_Col|Second_Col|..............and so on|Last_Col
0123456789|Test Rec1|..............and so on|9876543210
9876543210|Test Record 2|..............and so on|0123456789
623452132333|T e s t R e c 3|..............and so on|865685611

So is there any way in SORT, SPLICE or ICETOOL to remove just the first and last column and then extract all the other fields in between without touching the data in any of the intermediate columns?

Thanks for your help!
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2012
Location: USA

PostPosted: Fri Nov 01, 2019 10:57 pm
Reply with quote

karthikb_itpro wrote:
Code:
OUTREC PARSE=(%=(ENDBEFR=C'|'),
                      %01=(ENDBEFR=C'|',FIXLEN=10),
                      %72=(ENDBEFR=C'|',FIXLEN=20),
                          %=(FIXLEN=35)),
             BUILD=(1,4,                          * RDW
                        %01 and so on) . . .


But the problem with this is that I have to give FIXLEN to each field I declare in the PARSE which I don't want to as it will add trailing spaces towards the end of each column. As each column can contain spaces in between also, so removing only the trailing spaces through SQZ wouldn't be an option.

I would assume that normally "spaces between" must be all converted to a single space each.

If so then use the Option VL after each %-variable field:
Code:
 BUILD=(. . . %1,SQZ=(VL,MID=C' '), . . .


Would make sense also to replace ENDBEFR= parameter with ENDAT=, to simplify the final BUILD= list
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top