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
 

 

Zero suppress and shift left

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Zero suppress and shift left
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: 1715
Location: UK

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

Pleas use the code-tags to preserve you spaces.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Mon Nov 02, 2015 5:02 am    Post subject: Reply to: Zero suppress and shift left
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: 1445
Location: Azeroth

PostPosted: Mon Nov 02, 2015 1:28 pm    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Nov 02, 2015 11:39 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Tue Nov 03, 2015 12:54 pm    Post subject: Reply to: Zero suppress and shift left
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    Post subject:
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

Moderator


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

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

Just a thought would not EDIT + SQZ help?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7232

PostPosted: Wed Nov 04, 2015 12:46 pm    Post subject: Reply to: Zero suppress and shift left
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    Post subject:
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    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 Coverting PD to FS and also left just... Atul Banke DFSORT/ICETOOL 6 Wed Aug 24, 2016 4:31 pm
No new posts technology shift from Mainfame to AS400 Prayag P V All Other Mainframe Topics 3 Tue Jul 19, 2016 12:13 pm
No new posts How to suppress retun code of partil ... mkk157 DB2 9 Fri May 27, 2016 6:59 am
No new posts Overlay with right shift Bill Woodger DFSORT/ICETOOL 3 Thu Jan 28, 2016 7:49 pm
This topic is locked: you cannot edit posts or make replies. BBC is seeking a Security Operations ... Express Mainframe Jobs 0 Tue Dec 22, 2015 1:20 am


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