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

Selecting only the charater part using sort or icetool


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

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Tue Aug 07, 2012 12:19 pm
Reply with quote

Hi All,
Whether it is possible to do the following using sort or Icetool?
I am having a record which looks like

Code:
Line 1             Line2          Line3         Line4           City
ABCDE              FGHI           KLM           EFGHT           ARGENTINA
ABC DI             EFGH                                         NEW YORK


The copybook of this record is
ADDRESS LINE 1: PIC X(30)
ADDRESS LINE 2: PIC X(30)
ADDRESS LINE 3: PIC X(30)
ADDRESS LINE 4: PIC X(30)
CITY : PIC X(15)

I have to join the record and move it into a file having LRECL as 50 and its a FB. The condition is to select only the fields which are populated and ignore rest of the bytes (whenever there are two continuous spaces ignore rest of the bytes).
The output I am expecting will look like:

Code:
ABCDE FGHI KLM EFGHT ARGENTINA
ABC DI EFGH NEWYORK
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Tue Aug 07, 2012 1:01 pm
Reply with quote

Hello,
For the input field ABC DI output is ABC DI
But for input field NEW YORK output is NEWYORK

Is this correct input/output data, do you want blank suppressed for the country field alone?
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Aug 07, 2012 1:53 pm
Reply with quote

Hello,

Assuming the city field does not need to be suppressed.

Try the below snippet,

Code:
//DOIT EXEC PGM=SORT                                                   
//SORTIN  DD *                                                         
 ABCDE              FGHI           KLM           EFGHT       ARGENTINA
 ABC DI             EFGH                                        NEWYORK
//SORTOUT DD SYSOUT=*                                                   
//SYSIN DD *                                                           
 OPTION COPY                                                           
 INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C' '))                           
/*
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Tue Aug 07, 2012 1:53 pm
Reply with quote

you may try this

Code:
BUILD=(1,50,SQZ=(SHIFT=LEFT,PAIR=QUOTE,MID=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 Aug 07, 2012 2:21 pm
Reply with quote

OK, guys, helpful. City is shown as shifted, PAIR=QUOTE is not needed (no quotes in example data).

What about the output size of 50 and the fact that the data, including blanks, occupies 135 bytes. How much of that will BUILD with 1,50 or 1,80 get?

So, you need all the data, and an output length of 50.

Nitin Bhargava,

You realise it will be quite easy to loose data going to a length of 50? Is the name the most significant item for you, or the city?
Back to top
View user's profile Send private message
knickraj
Warnings : 1

New User


Joined: 11 Jun 2007
Posts: 50
Location: Euro

PostPosted: Tue Aug 07, 2012 6:55 pm
Reply with quote

Apologies for a wrong post icon_sad.gif
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 Aug 07, 2012 8:04 pm
Reply with quote

No problem. TS has wondered off anyway, it seems.

Code:
   OPTION COPY
                                               
   INREC BUILD=(1,135,SQZ=(SHIFT=LEFT,MID=C' '))
  OUTREC BUILD=(1,50)


Code:
  OPTION COPY
                                                         
   INREC BUILD=(1,135,SQZ=(SHIFT=LEFT,MID=C' '))
  OUTREC IFOUTLEN=50,
       IFTHEN=(WHEN=(51,85,CH,NE,C' '),OVERLAY=(50:C'?'))


Code:
OPTION COPY
                                                                 
 INREC IFOUTLEN=50,
       IFTHEN=(WHEN=INIT,BUILD=(1,135,SQZ=(SHIFT=LEFT,MID=C' '))),
       IFTHEN=(WHEN=(51,85,CH,NE,C' '),OVERLAY=(50:C'?'))


Not asked for, but I thought I'd do a flag for the truncation. Since one character is already lost, at least, I'm thinking the 50th can be utilised for this :-)
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Aug 07, 2012 9:20 pm
Reply with quote

Bill,

I guess you forgot that SQZ has LENGTH parm which can be used to set the length. icon_wink.gif

Code:

INREC BUILD=(1,135,SQZ=(SHIFT=LEFT,MID=C' ',LENGTH=50))
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 Aug 07, 2012 9:35 pm
Reply with quote

Ahh... I just can't leave the "quart into a pint pot" alone. My full name is 27 characters. My "city" is nine. How the postie finds the place is 17. "Zip" is 8 plus a space. That leaves off the actual city, and the region (another 12). Then there is the road name, which I never use anyway. If I "chop" it early, I can't do the comparison :-)

I agree, Kolusu, your way is the best way to truncate the data, as the TS/OP wanted :-)
Back to top
View user's profile Send private message
Nitin Bhargava

New User


Joined: 22 May 2012
Posts: 32
Location: india

PostPosted: Tue Aug 07, 2012 11:38 pm
Reply with quote

Thanks bill, Kolusu.

Bill,
The name, zip and region is having a diffrent variable in my copybook. I have to join only this 5 fields to make a complete address. But anyway i will check it once with my production files whether anything is getting truncated.

Thanks again for all.

Regards
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Wed Aug 08, 2012 9:37 am
Reply with quote

Quote:
What about the output size of 50


Thank you bill for pointing it out.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Shift left VB record without x00 endi... DFSORT/ICETOOL 11
Search our Forums:

Back to Top