Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
Mr.Niceguy

New User

Joined: 16 Jun 2005
Posts: 63

 Posted: Mon Nov 06, 2006 10:30 am    Post subject: Moving x(3) to 9(3) where x(3) having numeric values 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

Mr.Niceguy

New User

Joined: 16 Jun 2005
Posts: 63

 Posted: Mon Nov 06, 2006 10:56 am    Post subject: Re: Need asolution in COMP 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.
dbzTHEdinosauer

Global Moderator

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

 Posted: Mon Nov 06, 2006 4:42 pm    Post subject: Re: Need asolution in COMP 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.
Mr.Niceguy

New User

Joined: 16 Jun 2005
Posts: 63

 Posted: Tue Nov 07, 2006 9:20 am    Post subject: 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
star_dhruv2000

New User

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

 Posted: Tue Nov 07, 2006 11:43 am    Post subject: 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.
Mr.Niceguy

New User

Joined: 16 Jun 2005
Posts: 63

 Posted: Tue Nov 07, 2006 12:15 pm    Post subject: 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..
mani_jnumca

New User

Joined: 18 Jan 2006
Posts: 16
Location: PUNE

 Posted: Tue Nov 07, 2006 4:04 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values Hi can u give me idea how u have done thats!!!
shunmuga

New User

Joined: 12 Sep 2006
Posts: 1
Location: bangalore

 Posted: Wed Nov 08, 2006 8:48 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values 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.....
mani_jnumca

New User

Joined: 18 Jan 2006
Posts: 16
Location: PUNE

 Posted: Thu Nov 09, 2006 10:33 am    Post subject: Hi Mr.Niceguy plz let me know how u have did move x(3) to 9(3) through unstring method......
chandu321
Currently Banned

New User

Joined: 27 Jun 2006
Posts: 8

 Posted: Thu Nov 09, 2006 2:20 pm    Post subject: Re: Moving x(3) to 9(3) where x(3) having numeric values 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
star_dhruv2000

New User

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

 Posted: Fri Nov 10, 2006 7:52 pm    Post subject: if u are not aware of string length then instead of a(1:2) u can use a(1 this will take entire length.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics attchmvs from rexx subroutine that re... harisukumaran CLIST & REXX 1 Fri Jan 19, 2018 5:29 am Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us