IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

wanted to supress the leading ZERO's while displaying values


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 1208
Location: Bangalore,India

PostPosted: Wed Jun 28, 2006 3:23 pm
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
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts IBM OnDemand Folders displaying to al... IBM Tools 6
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Remove leading zeroes SYNCSORT 4
Search our Forums:

Back to Top