Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Moving x(3) to 9(3) where x(3) having numeric values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Mr.Niceguy

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Mon Nov 06, 2006 10:30 am    Post subject: Moving x(3) to 9(3) where x(3) having numeric values
Reply with quote

Hi all,

Here I have a condition like.

Moving x(3) to 9(3) where x(3) having numeric values. Let us say I'm moving value '53'

x(3) = (-53) is moved as 9(3) =(053)

Again I just want to move 9(3) to 9(4).

9(3) = (053) is moved as 9(4) = (0530). ---> I just want this value as (0053).

Plz find a solution and post it

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

Mr.Niceguy

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Mon Nov 06, 2006 10:56 am    Post subject: Re: Need asolution in COMP
Reply with quote

Sorry guys,

when I try to move x(3) to 9(3) itself it moved as
-53 to 530

Here I just want to supress last digit of 530. Please let me knw if u have solution

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Mon Nov 06, 2006 4:42 pm    Post subject: Re: Need asolution in COMP
Reply with quote

really depends on what is in the x(3) field. If you want to extract the numeric value contained in the x(3) field, suggest you use NUMVAL and a SIGNED NUMERIC field to receive the conversion. Then move the Signed Numeric to unsigned.

If you only want to drop the last (right most) digit, either divide by 10 or redefine your numeric display field with two fields.
Back to top
View user's profile Send private message
Mr.Niceguy

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Tue Nov 07, 2006 9:20 am    Post subject:
Reply with quote

Hi Dick,

the input value of x(3) is numeric, it may three digit, two digit or single digit. I want to move this x(3) to 9(3) . If input value is single digit say an example 4. i want to get it as 004 in 9(3) variable. If it is double digit i want to get it as 053.

Can you help me how to handle this one.

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

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Tue Nov 07, 2006 11:43 am    Post subject:
Reply with quote

hey bro u can do it by using reference modification. I dont think there is any other option for this. but this works for sure.

ID DIVISION.
PROGRAM-ID. 'HEMANT'.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC X(3) VALUE '53'.
01 B PIC Z9(2).
PROCEDURE DIVISION.
MOVE A(1:2) TO B.
DISPLAY B.
STOP RUN.
Back to top
View user's profile Send private message
Mr.Niceguy

New User


Joined: 16 Jun 2005
Posts: 63

PostPosted: Tue Nov 07, 2006 12:15 pm    Post subject:
Reply with quote

Hemant,

Thanks for your response.

The input may come as single digit also.. It will not applicable for that I think.. I just did by unstring method. It performs well..

Thanks Alot Guys..
Back to top
View user's profile Send private message
mani_jnumca

New User


Joined: 18 Jan 2006
Posts: 16
Location: PUNE

PostPosted: Tue Nov 07, 2006 4:04 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values
Reply with quote

Hi can u give me idea how u have done thats!!!
Back to top
View user's profile Send private message
shunmuga

New User


Joined: 12 Sep 2006
Posts: 1
Location: bangalore

PostPosted: Wed Nov 08, 2006 8:48 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values
Reply with quote

hi dude!!!
IM shunmugaa , i think i can solve ur prblm.

you know digit are right justify when we try to insert into a working storage variable.if there is a blank spaces,then it will add zeros to those blank spaces.....ok got it...

so if u dont want at it when output use zero supressor,refer cobol book
about data transfer.......you will get clear picture ok.....
Back to top
View user's profile Send private message
mani_jnumca

New User


Joined: 18 Jan 2006
Posts: 16
Location: PUNE

PostPosted: Thu Nov 09, 2006 10:33 am    Post subject:
Reply with quote

Hi Mr.Niceguy
plz let me know how u have did move x(3) to 9(3) through unstring method......
Back to top
View user's profile Send private message
chandu321
Currently Banned

New User


Joined: 27 Jun 2006
Posts: 8

PostPosted: Thu Nov 09, 2006 2:20 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values
Reply with quote

Hi
I guess if u right justify x(3) u may get proper results. ex 53 is moved fitst byte will be blank and other two bytes will have 53 and this u can easily move to 9(3) since 9(3) will be right justified by default.

Thanks
Chandu
Back to top
View user's profile Send private message
star_dhruv2000

New User


Joined: 03 Nov 2006
Posts: 87
Location: Plymouth, MN USA

PostPosted: Fri Nov 10, 2006 7:52 pm    Post subject:
Reply with quote

if u are not aware of string length then instead of a(1:2) u can use a(1icon_smile.gif this will take entire length.
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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us