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
 

 

Selecting only the charater part using sort or icetool

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Selecting only the charater part using sort or icetool
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: 1445
Location: Azeroth

PostPosted: Tue Aug 07, 2012 1:01 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Selecting only the charater part using sort or ice
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 07, 2012 2:21 pm    Post subject: Reply to: Selecting only the charater part using sort or ice
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    Post subject:
Reply with quote

Apologies for a wrong post icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 07, 2012 8:04 pm    Post subject: Reply to: Selecting only the charater part using sort or ice
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Aug 07, 2012 9:35 pm    Post subject: Reply to: Selecting only the charater part using sort or ice
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    Post subject: Reply to: Selecting only the charater part using sort or ice
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    Post subject:
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    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 Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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