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

SQZ=(SHIFT=LEFT) with IFTHEN


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

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue Jul 09, 2013 12:32 am
Reply with quote

Hi all,

I have a input record to be squeezed but if there is any spaces as the only value in the field - I would like to retain only one space.

could any of you please help how we could achive this

Input record
Code:

"AA  ","BBBBB    ","CCC'CCCC      ","DDD D","    "


My current sort cord
Code:

OPTION COPY                       
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))


My current output
Code:

"AA","BBBBB","CCC'CCCC","DDDD",""


Whereas my expected output is

Code:

"AA","BBBBB","CCC'CCCC","DDDD"," "


Please note the space in the last field.

Thank you very much!
Back to top
View user's profile Send private message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Tue Jul 09, 2013 12:43 am
Reply with quote

Kind of arrived at the solutions icon_smile.gif

But is there any other intresting solution - I would like to know !

Code:
OPTION COPY                             
INREC BUILD=(1,80,SQZ=(SHIFT=LEFT))     
OUTREC FINDREP=(IN=C',""',OUT=C'," "') 
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: Tue Jul 09, 2013 12:54 am
Reply with quote

I hink you're about there. You don't need both INREC and OUTREC. I assume you want the embedded blank to disappear from "DDD D"? The inclusion of the "," in your test isn't strictly needed (you shouldn't have another way to get "" together) and it would mean your code would not work if the first "column" of your CSV were "blank".

Code:
OPTION COPY                             
INREC IFTHEN=(WHEN=INIT,BUILD=(1,80,SQZ=(SHIFT=LEFT))),     
      IFTHEN=(WHEN=INIT,FINDREP=(IN=C'""',OUT=C'" "')) 
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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Cant find hex value using IFTHEN=(WHEN DFSORT/ICETOOL 12
No new posts IFTHEN : Is there a better way? DFSORT/ICETOOL 7
No new posts Outrec IFTHEN builds data in wrong po... DFSORT/ICETOOL 6
Search our Forums:

Back to Top