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
 

 

wanted to supress the leading ZERO's while displaying values

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

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Wed Jun 28, 2006 1:03 pm    Post subject: wanted to supress the leading ZERO's while displaying values
Reply with quote

IF I = 1
DISPLAY 'Total ABC Calls : ' ABC-CE-TRGT(J, I)
END-IF

In this two dimensional clause, I have declared ABC-CE-TRGT as PIC 9(18). Now Whlile displaying these values I wanted to supress the leading zeros.
Can any one help me on How to display the value after supressing leading zeros?

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

Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Wed Jun 28, 2006 1:53 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi
Declare
01 ws-edit pic z(17)9. in working storage section.
move ABC-CE-TRGT(J, I) to ws-edit.
ws-edit contains zero suppressed value.

Regards

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

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Wed Jun 28, 2006 2:30 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi Aji, I tried with your code, and its working fine. Thank you very much for your help. Again one more query, if I wanted to display this value as Left Justified, how to code it? I have see in the Reference material that we can't use Justify clauses for Numerics or Numeric Edited Values. Is there any other way?

Thanks!
Rat...

Aji wrote:
Hi
Declare
01 ws-edit pic z(17)9. in working storage section.
move ABC-CE-TRGT(J, I) to ws-edit.
ws-edit contains zero suppressed value.

Regards

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

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jun 28, 2006 3:23 pm    Post subject:
Reply with quote

Declare 01 ws-edit pic z(17)9 left.
move ABC-CE-TRGT(J, I) to ws-edit.
ws-edit contains zero suppressed value & left aligned
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Wed Jun 28, 2006 4:57 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi
You can use the following method also, if anyother simple method is not available.

working-storage section.
01 a pic 9(18) value 0.
01 b redefines a pic x(18).
01 l pic 99 value 1.
01 ws-new pic x(18).
01 ws-temp pic x value "0".
01 ws-x pic 99.
procedure division.
p1.
accept a.
perform p2 varying l from 1 by 1 until ws-temp not = "0".
compute ws-x = 18 - l + 2.
subtract 1 from l.
move b(l:ws-x) to ws-new.
display ws-new.
stop run.
p2.
move b(l:1) to ws-temp.


Regards

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

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Thu Jun 29, 2006 8:16 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi Aji, once again thank you very much. I tried with this logic, and its working fine.
Also I need one suggestion from you.

Can you give me some tips to become an expert in Cobol. B'cos Recently I strated my career in Cobol. and also in our company we are not using Cobol much. Just now only I started doing Analysis and adding some logic to my program. Also I am too much poor in Table Handling concepts. Though I studied hundreds of times, I couldn't be proficient in this concept.

Thanks!
RAt...
Back to top
View user's profile Send private message
crrindia

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Thu Jun 29, 2006 8:18 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi Aji, once again thank you very much. I tried with this logic, and its working fine.
By seeing these things you are looking like an expert in Cobol.
If you don't mind I need some suggestion from you...

Please give me some tips to become an expert in Cobol. B'cos Recently I strated my career in Cobol. and also in our company we are not using Cobol much. Just now only I started doing Analysis and adding some logic to my program. Also I am too much poor in Table Handling concepts. Though I studied hundreds of times, I couldn't be proficient in this concept.

Thanks!
RAt...
Back to top
View user's profile Send private message
Aji

New User


Joined: 03 Feb 2006
Posts: 53
Location: Mumbai

PostPosted: Fri Jun 30, 2006 11:45 am    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi
Refer some good cobol books.Understand the concepts.Then practice and practice and practice...
If you have any difficulty seek expert opinion.
This will make you perfect.

Table handling is not a difficult issue in cobol, you start with
single dimensional table, then multi dimensional.

Write a two dimensional array to accept a matrix, display it etc.
Then accept two matrices add it, display it etc...
Again, practice will make you perfect.


Regards
Aji Cherian
Back to top
View user's profile Send private message
crrindia

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Tue Jul 04, 2006 12:39 pm    Post subject: Re: wanted to supress the leading ZERO's while displaying va
Reply with quote

Hi Aji, Thank you very much for you suggestion. Here after I'll follow in this way. As of now I didn't practice, I always referring the materials. Here onwards I'll start doing practice also.

Thanks!
RAt...
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


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