How to manipulate the numeric edited field from input
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Application Programming

#1: How to manipulate the numeric edited field from input Author: mainframemouli PostPosted: Fri Dec 09, 2005 11:21 pm
    —
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.....








#2:  Author: kolusuLocation: San Jose PostPosted: Sat Dec 10, 2005 10:07 am
    —
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

#3:  Author: Sendilkumar PostPosted: Mon Oct 09, 2006 4:30 am
    —
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

#4:  Author: dz PostPosted: Mon Oct 09, 2006 9:24 am
    —
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



MVSFORUMS.com -> Application Programming


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group