View previous topic :: View next topic |
Author |
Message |
mainframemouli Beginner
Joined: 23 Feb 2005 Posts: 87 Topics: 33
|
Posted: Fri Dec 09, 2005 11:21 pm Post subject: How to manipulate the numeric edited field from input |
|
|
I searched this forum but i can't get a relevant solution for this...
Input Field
------------
File -A
05 PRINTK-HED-AMOUNT-CUR PIC ZZZZZZZZZZ.99
The above mentioned filed should be summed up to any of the working-storage variable each and every time it reads the Input file.
That summed up Working storage variable should be manipulated to the output filed
05 AUDIT-COMPANY-MATCH-CUR-PAY PIC 9,999,999.99.
How can we do that?????
we had a solution like this
-----------------------------
Code: | MOVE PRINTK-HED-AMOUNT-CUR TO
SAVE-PRINTK-HED-AMOUNT-CUR
PERFORM VARYING X FROM 1 BY 1 UNTIL X > 12
IF (SAVE-PRINTK-HED-AMOUNT-CUR(X:1) >= 0)
ADD 1 TO Y
MOVE SAVE-PRINTK-HED-AMOUNT-CUR(X:1)
TO FORMAT1(Y:1)
END-IF
END-PERFORM
MOVE FORMAT1(1:Y) TO FORMAT-N
MOVE FORMAT2 TO STORE-PRINTK-HED-AMOUNT-CUR
ADD STORE-PRINTK-HED-AMOUNT-CUR TO
STORE-COMPANY-MATCH-CUR-PAY
MOVE 0 TO Y
MOVE ZEROES TO FORMAT-N
MOVE SPACES TO FORMAT1
where
STORE-PRINTK-HED-AMOUNT-CUR PIC 9(10)V99
VALUE ZEROES
SAVE-PRINTK-HED-AMOUNT-CUR PIC X(13)
01 FORMAT1 PIC X(12) VALUE SPACES.
01 FORMAT-N PIC 9(12) VALUE ZEROES.
01 FORMAT2 REDEFINES FORMAT-N PIC 9(10)V99. |
Before writing it into report
Code: | MOVE STORE-COMPANY-MATCH-CUR-PAY
TO TOTAL-COMPANY-MATCH-CUR-PAY
MOVE TOTAL-COMPANY-MATCH-CUR-PAY TO
AUDIT-COMPANY-MATCH-CUR-PAY
where
05 TOTAL-COMPANY-MATCH-CUR-PAY PIC 9,999,999.99
VALUE ZEROES. |
Then simillarly for the input file
FileB
-----
05 X4KVPT-MATCH-ELIGIBLE-PAY PIC 9,999,999.99.
This field has to be manipulated in the same way as i said for the field for file A.
Is there Anyother way This can be Done for the fields from both the input fileA and B ?????, How to manipulate the Numeric edited fiel that comes as a input??????
We used NUMVAL,NUMVAL-C also , its not giving the Result.
can anyone clarify on this.....
|
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12370 Topics: 75 Location: San Jose
|
Posted: Sat Dec 10, 2005 10:07 am Post subject: |
|
|
mainframemouli,
Try this untested code
Code: |
01 PRINTK-HED-AMOUNT-CUR PIC ZZZZZZZZZZ.99.
01 CHAR-NUM REDEFINES PRINTK-HED-AMOUNT-CUR PIC X(13).
01 W-NUM-DEC.
05 W-NUM PIC 9(10).
05 W-DEC PIC 99.
01 W-NUMBER PIC 9(10)V99.
01 W-TOTAL PIC 9(10)V99.
01 W-TOTAL-EDIT PIC 9,999,999.99.
INSPECT PRINTK-HED-AMOUNT-CUR
REPLACING LEADING SPACES BY '0'
UNSTRING CHAR-NUM DELIMITED BY '.'
INTO W-NUM, W-DEC
MOVE W-NUM-DEC TO W-NUMBER
COMPUTE W-TOTAL = W-TOTAL + W-NUMBER
MOVE W-TOTAL TO W-TOTAL-EDIT
DISPLAY W-TOTAL-EDIT
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Sendilkumar Beginner
Joined: 31 Aug 2006 Posts: 2 Topics: 1
|
Posted: Mon Oct 09, 2006 4:30 am Post subject: |
|
|
Hi,
For the same type of field, if we have sign bit also in declaration
For example,
File -A
05 PRINTK-HED-AMOUNT-CUR PIC ZZZZZZZZZZ.99-
How we can proceed to move to output file variable.
Thanks
Senthil kumar |
|
Back to top |
|
|
dz Beginner
Joined: 02 Apr 2006 Posts: 26 Topics: 0
|
Posted: Mon Oct 09, 2006 9:24 am Post subject: |
|
|
I believe there is an easier way to do the above. COBOL has so-called "de-editing" capabilities. Just move the edited field
(PIC ZZZZZZZZZZ.99 ) to a numeric field (PIC S9(10)v99 ) before doing anything |
|
Back to top |
|
|
|
|