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

Zero suppress and shift left


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

New User


Joined: 31 Oct 2015
Posts: 1
Location: usa

PostPosted: Sat Oct 31, 2015 9:28 pm
Reply with quote

I'm using DFSORT to reformat records. I want to suppress leading zeros on an alphnummeric field and shift the result left.

I cannot cause the data to shift left.

Please help,

JB

this is how my data looks before the overlay:


Command ===>
****** ***************************** Top of
000001 542 123456
000002 542 ABC012
000003 542 9874563210
000004 542 ABCC011
000005 542 ABCC013
000006 542 ABCC014
000007 542 ABCC015
000008 542 ABCC016
000009 542 017ABCC -- leading zeros
000010 542 018ABCC

this is how it looks after the overlay:
Code:
Command ===>
****** ***************************** Top of
000001 542               123456
000002 542               ABC012
000003 542               9874563210
000004 542               ABCC011
000005 542               ABCC013
000006 542               ABCC014
000007 542               ABCC015
000008 542               ABCC016
000009 542                17ABCC  -- leading zeros overlayed with space
000010 542                18ABCC


This is how I want it to look:
Code:
Command ===>
****** ***************************** Top of
000001 542               123456
000002 542               ABC012
000003 542               9874563210
000004 542               ABCC011
000005 542               ABCC013
000006 542               ABCC014
000007 542               ABCC015
000008 542               ABCC016
000009 542               17ABCC  -- left justified after zeros replaced
000010 542               18ABCC



here is my code:

Code:
IFTHEN=(WHEN=(19,01,CH,EQ,C'0'),
OVERLAY=(19:C' '))


Code'd
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Sat Oct 31, 2015 9:58 pm
Reply with quote

Pleas use the code-tags to preserve you spaces.
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: Mon Nov 02, 2015 5:02 am
Reply with quote

Code:
 IFTHEN=(WHEN=(19,01,CH,EQ,C'0'),
                OVERLAY=(19:20,9,X))


This assumes your field is 10 bytes long and that you only want to shift out one leading zero.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


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

PostPosted: Mon Nov 02, 2015 1:28 pm
Reply with quote

Added to Bill's code,
Code:
  OPTION COPY
  INREC IFTHEN=(WHEN=(19,10,CH,EQ,C'0000000000'),OVERLAY=(19:10X)),
        IFTHEN=(WHEN=(19,09,CH,EQ,C'000000000'),OVERLAY=(19:28,1,9X)),
        IFTHEN=(WHEN=(19,08,CH,EQ,C'00000000'),OVERLAY=(19:27,2,8X)),
        IFTHEN=(WHEN=(19,07,CH,EQ,C'0000000'),OVERLAY=(19:26,3,7X)),
        IFTHEN=(WHEN=(19,06,CH,EQ,C'000000'),OVERLAY=(19:25,4,6X)),
        IFTHEN=(WHEN=(19,05,CH,EQ,C'00000'),OVERLAY=(19:24,5,5X)),
        IFTHEN=(WHEN=(19,04,CH,EQ,C'0000'),OVERLAY=(19:23,6,4X)),
          IFTHEN=(WHEN=(19,03,CH,EQ,C'000'),OVERLAY=(19:22,7,3X)),   <- YES!! I can hear people with OCD crying!!  muhahaha...! ";.;"  :evil:
        IFTHEN=(WHEN=(19,02,CH,EQ,C'00'),OVERLAY=(19:21,8,2X)),
        IFTHEN=(WHEN=(19,01,CH,EQ,C'0'),OVERLAY=(19:20,9,X))
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Nov 02, 2015 11:39 pm
Reply with quote

Add JFY=(SHIFT=LEFT) in OUTREC BUILD to your card, But I don't think Bill would encourage two passes ( I guess it will) otherwise he could have suggested. icon_confused.gif
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Tue Nov 03, 2015 8:04 am
Reply with quote

how about this one?
Code:
  SORT FIELDS=COPY                     
  INREC FINDREP=(STARTPOS=18,ENDPOS=28,
                 IN=(C' 0000000000',   
                     C' 000000000',   
                     C' 00000000',     
                     C' 0000000',     
                     C' 000000',       
                     C' 00000',       
                     C' 0000',         
                     C' 000',         
                     C' 00',           
                     C' 0'),OUT=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 Nov 03, 2015 12:54 pm
Reply with quote

boyti ko,

No, that will replace zeros anywhere in that range with blanks.

For information, to replace with "nothing" (ie cause the data to shift left) use nothing (C'').

Rohit, not so much two passes of the data as two operations.
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Wed Nov 04, 2015 11:10 am
Reply with quote

Hi Bill,

I have indicated a space before the zeroes. So the zeroes in between will not be affected. Although I'm also expecting a better answer. Since vasanthz is correct that people with OCD will react on this one.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Nov 04, 2015 12:27 pm
Reply with quote

Just a thought would not EDIT + SQZ help?
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: Wed Nov 04, 2015 12:46 pm
Reply with quote

boyti ko,

OK. The IFTHEN=(WHEN=(logicalexpression has one test per possible leading-zero pattern. You, currently, have that many tests for the first element of the FINDREP.

You can improve that slightly by including DO=1. DO should always be there when there a limit to the number of changes possible (other than the length specified or implied to the FINDREP).

However, the number of tests can't be limited when there are no leading zeros.

You'd also have to know if there were actual data following the field being FINDREPed.

Pandora-Box,

There are alphanumeric data items as well. Any leading blanks there would disappear with SQZ or JFY (better for this example).

It would be less code, but more CPU.
Back to top
View user's profile Send private message
boyti ko

New User


Joined: 03 Nov 2014
Posts: 78
Location: Malaysia

PostPosted: Thu Nov 05, 2015 7:38 am
Reply with quote

Yes Bill, now I realize it. Thanks for pointing out that one.
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 Shift left VB record without x00 endi... DFSORT/ICETOOL 11
No new posts Suppress messages from being written ... All Other Mainframe Topics 6
No new posts Squeeze record left so that zeroes ar... SYNCSORT 5
No new posts Suppress value reported by BREAK in D... DFSORT/ICETOOL 3
No new posts Coverting PD to FS and also left just... DFSORT/ICETOOL 6
Search our Forums:

Back to Top