View previous topic :: View next topic
|
Author |
Message |
Sumit Gupta
New User
Joined: 01 May 2014 Posts: 4 Location: India
|
|
|
|
Hi,
I am receiving data from Oracle OSB via SOA service in my COBOL program in below format,
WS-VAR1 PIC 9(13)V99
I need to convert it to below format and pass it to downstream,
WS-VAR2 PIC S9(13)V99 COMP-3
I am successfully able to move the data from WS-VAR1 to WS-VAR2 but just wanted to make sure that I am doing it correctly.
Can anyone confirm if there will not be any data loss in this movement.
Thanks |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
There's a massive loss of human data, clarity, when you use data-names like "VAR1" and "VAR2".
"Hey, look at the program and tell me what the third field on the file is, please."
"Yeah, fine, it's VAR2."
"OooooKkkkkkk.... what does it contain?"
"Well, we move VAR1 to it."
Other than that, you have 13 integer digits and two decimal digits on both fields, what could go wrong? Oh, there's the signs. Your source is unsigned, your destination signed. Check that your source really has no sign, then check that you should actually bother with a sign on the destination - can it ever be negative? |
|
Back to top |
|
|
Sumit Gupta
New User
Joined: 01 May 2014 Posts: 4 Location: India
|
|
|
|
Hi Bill,
This field contains amount which can go up to 13 digits and 2 decimal digits.
Also for your next question regarding sign, Source is not having sign and value can not be negative at any point of time and we have a requirement to send the sign to destination so cannot skip that. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Well, someday someone is going to be confused and waste time/cause a problem with the signed/unsigned thing, but it is the requirement....
Your are not losing any digits, anyway. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
You might want to check
Code: |
IF WS-VAR1 IS NOT NUMERIC THEN
DISPLAY 'VAR1 HAS JUNK !'
MOVE 0 TO WS-VAR2
ELSE
MOVE WS-VAR1 TO WS-VAR2
END-IF |
or something like that. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
The signed/unsigned thing could be easily solved if the variables had a real name.
For example, WS-PRICE don't really need a sign (nothing costs -9.99$). |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Marso wrote: |
The signed/unsigned thing could be easily solved if the variables had a real name.
For example, WS-PRICE don't really need a sign (nothing costs -9.99$). |
Just to play the devil's advocate, how about adjustments? You never know what future enhancements/requirements can come up. |
|
Back to top |
|
|
|