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

How to SQUEEZE 3 fields into one?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1436
Location: Bangalore,India

PostPosted: Thu Mar 29, 2007 4:32 pm
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
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 Developer


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

PostPosted: Thu Mar 29, 2007 8:53 pm
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: 1436
Location: Bangalore,India

PostPosted: Fri Mar 30, 2007 10:23 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Concatenate 2 fields (usage national)... COBOL Programming 2
No new posts Cobol COMP-2 fields getting scrambled... Java & MQSeries 6
No new posts Converting unpacked fields to pack us... SYNCSORT 4
No new posts Data for newly added fields not displ... IMS DB/DC 6
This topic is locked: you cannot edit posts or make replies. SUM FIELDS=NONE in reverse - Get dupl... DFSORT/ICETOOL 9
Search our Forums:

Back to Top