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
 

 

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 How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


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