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
 

 

Convert Numeric field to chacter with supressing leading zer

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

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Mon Feb 02, 2009 1:32 pm    Post subject: Convert Numeric field to chacter with supressing leading zer
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: 269
Location: Mumbai

PostPosted: Mon Feb 02, 2009 2:50 pm    Post subject: Reply to: Convert Numeric field to chacter with supressing l
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

Site Director


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

PostPosted: Mon Feb 02, 2009 8:54 pm    Post subject:
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 Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Feb 02, 2009 10:51 pm    Post subject:
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    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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm


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