Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Numeric variable movement

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

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed May 26, 2010 12:06 pm    Post subject: Numeric variable movement
Reply with quote

Hi,

I have below two variables in input file defined as shown below

Code:

05 CUR-MTH-TTL-ADJUSTMENTS   PIC 9(13).9(2).
05 CUR-MTH-FTP-BASE-RATE     PIC 9(13).9(2).


I have below table variables in which above variables are populating

Code:

05 FTP-FTP-RT-AJ-AM                PIC S9(13)V9(5) COMP-3.
05 FTP-FTP-BAS-RT                  PIC S9(9)V9(9) COMP-3.


Kindly advise if direct movement is possible or need any workaround.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed May 26, 2010 1:39 pm    Post subject:
Reply with quote

What have you tried out till now? what is the problem you are facing?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8123
Location: East Dubuque, Illinois, USA

PostPosted: Wed May 26, 2010 4:31 pm    Post subject:
Reply with quote

Your source variables are numeric edited variables. Section 6.2.24.1.1 of the COBOL Language Reference manual (link at the top of the page) gives you the rules for elementary moves, including numeric edited variables.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed May 26, 2010 5:12 pm    Post subject:
Reply with quote

Please search the COBOL part of Forum - you might search with author as "Robert Sample" or "Bill O'Boyle", for example. They have given very nifty explanations on such questions many times.
Back to top
View user's profile Send private message
nileshyp

New User


Joined: 22 Jun 2005
Posts: 65
Location: Mumbai

PostPosted: Wed May 26, 2010 6:04 pm    Post subject: Reply to: Numeric variable movement
Reply with quote

I am surprise to see that direct movement is possible but dont know how.

It would be really great If someone could explain how that really works (NO bookish answer pleasee) as till date I was thinking direct movement from 9(13).9(2) to PIC S9(09)V9(9) COMP-3 is not possible.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed May 26, 2010 6:07 pm    Post subject: Re: Reply to: Numeric variable movement
Reply with quote

nileshyp wrote:
(NO bookish answer pleasee)
ok, what "bookish answer" do you have with you?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8123
Location: East Dubuque, Illinois, USA

PostPosted: Wed May 26, 2010 6:18 pm    Post subject:
Reply with quote

I'm not quite sure why you would ever think that movement of a numeric variable would not be allowed to a numeric variable in COBOL. There is a link to manuals at the top of the page. You would benefit from spending some time in the COBOL Language Reference and Programming Guide manuals, reading them.

Code:
Code:
      01  WS-VARS.
          05 CUR-MTH-TTL-ADJUSTMENTS  PIC 9(13).9(2).
          05 CUR-MTH-FTP-BASE-RATE    PIC 9(13).9(2).
          05 FTP-FTP-RT-AJ-AM         PIC S9(13)V9(5) COMP-3.
          05 FTP-FTP-BAS-RT           PIC S9(9)V9(9)  COMP-3.
      LINKAGE SECTION.
     /
      PROCEDURE DIVISION.
      S1000-MAIN       SECTION.
          MOVE 1234567891234.56       TO  CUR-MTH-TTL-ADJUSTMENTS.
          MOVE 9876543218765.54       TO  CUR-MTH-FTP-BASE-RATE.
          MOVE CUR-MTH-TTL-ADJUSTMENTS
                                      TO  FTP-FTP-RT-AJ-AM.
          MOVE CUR-MTH-FTP-BASE-RATE  TO  FTP-FTP-BAS-RT.
          DISPLAY 'CUR-MTH-TTL-ADJUSTMENTS ' CUR-MTH-TTL-ADJUSTMENTS.
          DISPLAY 'CUR-MTH-FTP-BASE-RATE   ' CUR-MTH-FTP-BASE-RATE.
          DISPLAY 'FTP-FTP-RT-AJ-AM        ' FTP-FTP-RT-AJ-AM.
          DISPLAY 'FTP-FTP-BAS-RT          ' FTP-FTP-BAS-RT.
produces output of
Code:
 CUR-MTH-TTL-ADJUSTMENTS 1234567891234.56
 CUR-MTH-FTP-BASE-RATE   9876543218765.54
 FTP-FTP-RT-AJ-AM        123456789123456000
 FTP-FTP-BAS-RT          543218765540000000
As to why it works, unless you are willing to spend time in the COBOL manuals you will not be able to learn the rules for variables and variable movement and hence it would be useless to explain. There are times when ONLY "bookish answers" can explain things.
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 Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us