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

Convert Numeric field to chacter with supressing leading zer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Mon Feb 02, 2009 1:32 pm
Reply with quote

Hi all,
Is it possible to suppress leading zeros using DFSORT .My requirement is as follows

I/P

Code:

----+----1
00011111
00002222
01111111


O/P

Code:

----+----1
11111
2222
1111111


Thanks in advance

Regards,
Chandan
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 275
Location: Mumbai

PostPosted: Mon Feb 02, 2009 2:50 pm
Reply with quote

Hi All,
I got one solution for above problem and the sort card is as below

SORT FIELDS=COPY
INREC BUILD=(1,10,ZD,EDIT=(IIIIIIII))
OUTREC BUILD=(1,10,JFY=(SHIFT=LEFT))

it solves the purpose and give desire output but there is one more issue with this solution

for the fileds input fileds having alphanumeric character it converts to corresponding ZD format

for example

I/P
----+----1
00011EEE

It gives O/P as

----+----1
11555

But I need it as

----+----1
11EEE

Please help me out in this

Regards,
Chandan
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Feb 02, 2009 8:54 pm
Reply with quote

Hello,

Your initial post showed numeric values. Now there are numeric and alpha values. You have defined a field with alphabetic values as a zoned-decimal numeric which is the reason for the 5's.

What other "surprises" might there be?

What are the recfm and lrecl of the data? What positions in the data are to be worked on?
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: Mon Feb 02, 2009 10:51 pm
Reply with quote

Chandan,

Assuming you have 8 character values as shown in your example, you can use a DFSORT job like the following to do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
00011111
00002222
00002200
01111111
00011EEE
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'0',AND,2,1,CH,NE,C'0'),
    OVERLAY=(1:X)),
   IFTHEN=(WHEN=(1,2,CH,EQ,C'00',AND,3,1,CH,NE,C'0'),
    OVERLAY=(1:2X)),
   IFTHEN=(WHEN=(1,3,CH,EQ,C'000',AND,4,1,CH,NE,C'0'),
    OVERLAY=(1:3X)),
   IFTHEN=(WHEN=(1,4,CH,EQ,C'0000',AND,5,1,CH,NE,C'0'),
    OVERLAY=(1:4X)),
   IFTHEN=(WHEN=(1,5,CH,EQ,C'00000',AND,6,1,CH,NE,C'0'),
    OVERLAY=(1:5X)),
   IFTHEN=(WHEN=(1,6,CH,EQ,C'000000',AND,7,1,CH,NE,C'0'),
    OVERLAY=(1:6X)),
   IFTHEN=(WHEN=(1,7,CH,EQ,C'0000000',AND,8,1,CH,NE,C'0'),
    OVERLAY=(1:7X)),
   IFTHEN=(WHEN=(1,8,CH,EQ,C'00000000'),
    OVERLAY=(1:8X))
 OUTREC BUILD=(1,10,JFY=(SHIFT=LEFT))
/*


SORTOUT would have:

Code:

11111     
2222     
2200     
1111111   
11EEE     
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top