MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to manipulate the numeric edited field from input

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mainframemouli
Beginner


Joined: 23 Feb 2005
Posts: 87
Topics: 33

PostPosted: Fri Dec 09, 2005 11:21 pm    Post subject: How to manipulate the numeric edited field from input Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12370
Topics: 75
Location: San Jose

PostPosted: Sat Dec 10, 2005 10:07 am    Post subject: Reply with quote

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 - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sendilkumar
Beginner


Joined: 31 Aug 2006
Posts: 2
Topics: 1

PostPosted: Mon Oct 09, 2006 4:30 am    Post subject: Reply with quote

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
View user's profile Send private message
dz
Beginner


Joined: 02 Apr 2006
Posts: 26
Topics: 0

PostPosted: Mon Oct 09, 2006 9:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group