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

Removing the period or dot from the value using cobol logic.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gopinak

New User


Joined: 23 Mar 2010
Posts: 1
Location: chennai

PostPosted: Wed May 09, 2018 1:53 pm
Reply with quote

One of the column is having decimal point in the value.
E.x 00006.0000

The declaration of the column is COLUMN1 PIC X(10)

This value should get changed or converted to '0000060000' without the decimal point.

Could you please help on the logic using cobol.

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

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed May 09, 2018 2:28 pm
Reply with quote

What have you tried so far, and what results do you get ?

What did Mr Google suggest ?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 09, 2018 5:11 pm
Reply with quote

Depending upon your version of COBOL, FUNCTION NUMVAL might be of assistance.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Wed May 09, 2018 9:03 pm
Reply with quote

Also to substitute NUMVAL, logically, you can loop thru by advancing 1 by1 the field value and the moment you hit "." just skip that and move the rest to the target field.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed May 09, 2018 9:31 pm
Reply with quote

Quote:
Could you please help on the logic using cobol.


unless the programming language provides a function to perform a specific task

the logic for a RYO implementation of the same task will not depend on the programming language
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 46
Location: India

PostPosted: Fri May 11, 2018 8:14 pm
Reply with quote

Move this value to array that occurs 10 times. Then read the values 1 by 1 thru perform loop and when you get to '.' , skip this value and write rest of the values from the loop to another array field. Hope this helps..
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri May 11, 2018 9:35 pm
Reply with quote

Quote:
Move this value to array that occurs 10 times. Then read the values 1 by 1 thru perform loop and when you get to '.' , skip this value and write rest of the values from the loop to another array field. Hope this helps..
Why array when you could use Reference Modification as suggested before?
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top