MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Spaces in Numeric filed

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
ha.rajamohamed
Beginner


Joined: 29 Jan 2006
Posts: 71
Topics: 22

PostPosted: Thu Nov 16, 2006 6:56 am    Post subject: Spaces in Numeric filed Reply with quote

Hi..

When I read my input file Numeric filed of 10 bytes.. 9(10) .. I am receiving " 1000"... first few bytes are spaces and numeric values comes in...
When I validate the field for Numeric.. its failing since spaces are there..

There are 500+ fileds.. where I can't use Inspect..replace option...
Is there any other way to remove to the spaces and take only the numeric portion...

Thanks in advance...

Raja Mohamed
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Nov 16, 2006 7:55 am    Post subject: Reply with quote

ha.rajamohamed,

Can you explain what are you trying to do ? Are u reading from a File into a record structure declared as say X(80) and that structure is divided into subfields.

Can you post you sample input file contents and the cobol record structure ?
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
ha.rajamohamed
Beginner


Joined: 29 Jan 2006
Posts: 71
Topics: 22

PostPosted: Thu Nov 16, 2006 8:52 am    Post subject: Reply with quote

Hi,,
The input file length is 18000....
We are reading in to a copy book layout... contains these Numeric fields..
If we receives it in a alphanumeric fileds it not a issue,
The issue is.. while we reading .. in the Numeric fileds. It contains spaces in it...
example..
in 9(10)... the values is " 11"... Eight spaces followed by 2 numeric values...
Now I need only the last two numeric values.. how to supress the spaces...

Thanks
Raja Moahamed
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Nov 16, 2006 9:12 am    Post subject: Reply with quote

ha.rajamohamed,


I am still not clear about the requirement but what my understanding goes the way below:
Code:

A 9(10)
B 9(02)

J = 1

PERFORM VARYING I FROM 1 BY 1 UNTIL I > 10
 IF A(I:1) EQUAL SPACES
    CONTINUE
 ELSE
    MOVE(I:1) TO B(J:1)
    ADD +1 TO J
 END-IF
END-PERFORM

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Thu Nov 16, 2006 9:49 am    Post subject: Reply with quote

Look up NUMVAL and NUMVAL-C intrinsic functions.

Code:

WORKING-STORAGE SECTION.             
01  A            PIC X(10).         
01  B            PIC 9(10).         
                                     
PROCEDURE DIVISION.       
         
   MOVE '        11'  TO A         

   COMPUTE B = FUNCTION NUMVAL(A)   
   DISPLAY B                         


Here is the link to NUMVAL

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGY3PG10/1.6.6.3?DT=20020923143836


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ha.rajamohamed
Beginner


Joined: 29 Jan 2006
Posts: 71
Topics: 22

PostPosted: Thu Nov 16, 2006 10:38 am    Post subject: Reply with quote

Kolusu...
Thanks..... it working fine with NUMVAL....
Thanks shekar.. for the information....

Regards
Raja Mohamed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group