Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Currently Banned

New User

Joined: 28 Sep 2006
Posts: 56

 Posted: Wed Aug 29, 2007 12:22 pm    Post subject: How to suppress the leading zeros 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

Aji

New User

Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

 Posted: Wed Aug 29, 2007 12:36 pm    Post subject: Declare a variable 01 edit_var pic z(8)9. and move the value to be edited to edit_var. Aji
jaspal

New User

Joined: 22 May 2007
Posts: 68
Location: mumbai

 Posted: Thu Aug 30, 2007 11:26 am    Post subject: Re: How to suppress the leading zeros 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
acevedo

Active User

Joined: 11 May 2005
Posts: 344
Location: Spain

Posted: Thu Aug 30, 2007 11:31 am    Post subject: Re: How to suppress the leading zeros

 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
acevedo

Active User

Joined: 11 May 2005
Posts: 344
Location: Spain

 Posted: Thu Aug 30, 2007 12:52 pm    Post subject: 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'.
acevedo

Active User

Joined: 11 May 2005
Posts: 344
Location: Spain

Posted: Thu Aug 30, 2007 1:46 pm    Post subject:

I meant:
 Code: 000000037        37 37
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm How to suppress retun code of partil ... mkk157 DB2 9 Fri May 27, 2016 6:59 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us