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: 8794
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: 8569
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: 2572
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

Senior Moderator


Joined: 14 Mar 2007
Posts: 10714
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: 42
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: 2572
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
This topic is locked: you cannot edit posts or make replies. Passing a field name to COBOL program COBOL Programming 10
No new posts COBOL Performance Tuning COBOL Programming 6
No new posts JCL for replacing code in Cobol JCL & VSAM 7
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts XML Parsing in COBOL creating "h... COBOL Programming 0
Search our Forums:

Back to Top