IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 7312
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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
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
No new posts IFTHEN HIT=NEXT BUILR should create m... DFSORT/ICETOOL 5
No new posts DO we have alternate syntax for IFTHEN? Compuware & Other Tools 8
No new posts INREC IFTHEN question SYNCSORT 2

Back to Top