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
 

 

How to suppress the leading zeros

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Madhu Reddy
Currently Banned

New User


Joined: 28 Sep 2006
Posts: 56

PostPosted: Wed Aug 29, 2007 12:22 pm    Post subject: How to suppress the leading zeros
Reply with quote

i have a variable with 9(9), when i pass value

for example 37 , i am getting as 000000037, i should not get leading zero,
i should get only 37, Please suggest the solution using cobol.

Thanks
Back to top
View user's profile Send private message

Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Wed Aug 29, 2007 12:36 pm    Post subject:
Reply with quote

Declare a variable
01 edit_var pic z(8)9.

and move the value to be edited to edit_var.


Aji
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Thu Aug 30, 2007 11:26 am    Post subject: Re: How to suppress the leading zeros
Reply with quote

HI
YOU CAN USE :
READ FILE:
MOVE FIELD TO WW-FILELD
MOVE ZEROES TO WW-COUNT
INSPECT WW-FIELD TALLYING WW-COUNT FOR LEADING
ZEROES.
( WHERE WW-FIELD= 000000037 AND WW-COUNT=NUMBER OF ZEROES,DECLARATION IN WORKING STORAGE AS
01 WW-COUNT PIC 9(2) VALUE ZEROES.
01 WW-FIELD PIC 9(15) VALUE ZEROES. )

THEN
COMPUTE WW-LEN = 15 - WW-COUNT
MOVE WW-FIELD(WW-COUNT:WW-LEN) TO WW-COUNT-O


EXPECTED RESULT WOULD BE WW-COUNT-O = 37
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Aug 30, 2007 11:31 am    Post subject: Re: How to suppress the leading zeros
Reply with quote

jaspal wrote:
HI
YOU CAN USE :
READ FILE:
MOVE FIELD TO WW-FILELD
MOVE ZEROES TO WW-COUNT
INSPECT WW-FIELD TALLYING WW-COUNT FOR LEADING
ZEROES.
( WHERE WW-FIELD= 000000037 AND WW-COUNT=NUMBER OF ZEROES,DECLARATION IN WORKING STORAGE AS
01 WW-COUNT PIC 9(2) VALUE ZEROES.
01 WW-FIELD PIC 9(15) VALUE ZEROES. )

THEN
COMPUTE WW-LEN = 15 - WW-COUNT
MOVE WW-FIELD(WW-COUNT:WW-LEN) TO WW-COUNT-O


EXPECTED RESULT WOULD BE WW-COUNT-O = 37



you must be joking icon_eek.gif
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Aug 30, 2007 12:52 pm    Post subject:
Reply with quote

I've re-read the original question and I can see it's not clear if the desired output for '000000037' is ' 37' or '37'.
Back to top
View user's profile Send private message
acevedo

Active User


Joined: 11 May 2005
Posts: 344
Location: Spain

PostPosted: Thu Aug 30, 2007 1:46 pm    Post subject:
Reply with quote

I meant:
Code:

000000037
       37
37
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to suppress retun code of partil ... mkk157 DB2 9 Fri May 27, 2016 6:59 am
No new posts Join key - Populate Zeros when Unpair... rexx77 DFSORT/ICETOOL 6 Thu May 12, 2016 12:22 am
No new posts Syncsort to remove the leading spaces V S Amarendra Reddy SYNCSORT 5 Fri Jan 08, 2016 9:47 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Jobs in Leading Indian MNC aman2248 Mainframe Jobs 0 Mon Dec 21, 2015 3:25 pm


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