View previous topic :: View next topic
|
Author |
Message |
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What have you tried out till now? what is the problem you are facing? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
nileshyp
New User
Joined: 22 Jun 2005 Posts: 65 Location: Mumbai
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
nileshyp wrote: |
(NO bookish answer pleasee) |
ok, what "bookish answer" do you have with you? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|