Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to SQUEEZE 3 fields into one?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Mar 29, 2007 3:27 pm    Post subject: How to SQUEEZE 3 fields into one?
Reply with quote

I want to squeeze 3 fields into one. Blanks in each field must be preseved. Say, I have these three fields:

Field1: Gl. Kongevej
Field2: 14 B
Field3: LGH. 231

The output must be:
Gl. Kongevej 14 B LGH. 231

I tried this code, but (of course) the quotes "inside" the resulting field are not removed. So my output is:
GL. KONGEVEJ" "14 A" "LGH. 231

Code:
//STEP01   EXEC PGM=ICETOOL                                         
//IN       DD *                                                     
GL. KONGEVEJ                            14 A      LGH. 231           
//OUT    DD SYSOUT=*
//SYMNAMES DD *
Q,X'7F' /* QUOTE
SPACE,C' '     
//TOOLIN   DD *                                                     
  COPY FROM(IN) TO(OUT) USING(CTL1)                                 
//CTL1CNTL DD *                                                     
  INREC BUILD=(01,40,JFY=(SHIFT=LEFT,LEAD=Q,TRAIL=Q,LENGTH=42),     
               41,10,JFY=(SHIFT=LEFT,LEAD=Q,TRAIL=Q,LENGTH=12),     
               51,30,JFY=(SHIFT=LEFT,LEAD=Q,TRAIL=Q,LENGTH=32))     
  OUTREC BUILD=(1,86,SQZ=(SHIFT=LEFT,PAIR=QUOTE,MID=SPACE,LENGTH=40))
OUTFIL FNAMES=OUT,                         
  BUILD=(1,40,JFY=(SHIFT=LEFT,PREBLANK=Q))


Can anyone help me with this?
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 4:32 pm    Post subject:
Reply with quote

Claes Norreen,

Change your CTL1 control card as below -


Code:
 
  INREC BUILD=(01,40,JFY=(SHIFT=LEFT,LENGTH=42),
               41,10,JFY=(SHIFT=LEFT,LENGTH=12),
               51,30,JFY=(SHIFT=LEFT,LENGTH=32))
  OUTFIL FNAMES=OUT,
         BUILD=(1,40,JFY=(SHIFT=LEFT,PREBLANK=SPACE))
  OUTREC FIELDS=(1,86,SQZ=(SHIFT=LEFT,PAIR=APOST,MID=SPACE,LENGTH=40))


OP of the above card -

Code:
GL. KONGEVEJ 14 A LGH. 231
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Thu Mar 29, 2007 5:34 pm    Post subject: Re: How to SQUEEZE this?
Reply with quote

Hi Murali,

Thanks for your reply! Your code works, and infact can be shortened to this:
Code:
OUTREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=SPACE,LENGTH=40))

However, this code (nor yours) won't preserve multiple blanks in the input. Can you make multiple blanks in the input work as well?

Thanks again,
Claes
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 29, 2007 8:53 pm    Post subject:
Reply with quote

I was going to suggest the simple SQZ statement but you came up with it yourself. As for handling multiple blanks, you're asking DFSORT to read your mind. There's no way DFSORT can tell which blanks belong to which fields - think about it. That's why this kind of input usually has quotes or apostrophes around the fields to identify them as separate fields.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Mar 30, 2007 10:23 am    Post subject:
Reply with quote

Claes,

If you want to preserve the multiple blanks, my suggestion is to use your original card and in the next step remove quotes using IFTHEN condition.
Back to top
View user's profile Send private message
Claes Norreen

Active User


Joined: 20 Dec 2005
Posts: 137
Location: Denmark

PostPosted: Fri Mar 30, 2007 2:16 pm    Post subject:
Reply with quote

Thanks both of you ;)
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 Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us