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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm


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