View previous topic :: View next topic |
Author |
Message |
vj2081 Beginner
Joined: 18 Oct 2004 Posts: 5 Topics: 5
|
Posted: Tue Oct 19, 2004 12:42 am Post subject: Move |
|
|
How to move
REQUESTED-DATE-CC PIC XX.
REQUESTED-DATE-YY PIC XX.
these 2 variable into,
MTC-COMM-PROC-MTH-NR PIC S9(04) COMP
this variable?
ex: CC - 19
YY - 99
and populate
MTH-NR as 1999? |
|
Back to top |
|
|
cobcurious Beginner
Joined: 04 Oct 2003 Posts: 68 Topics: 25
|
Posted: Tue Oct 19, 2004 4:51 am Post subject: |
|
|
Hi vj2081,
I believe you can make a group levelfield for the REQUESTED-DATE-CC PIC XX and REQUESTED-DATE-YY PIC XX.Say
01 Group
05 REQUESTED-DATE-CC PIC XX.
05 REQUESTED-DATE-YY PIC XX.
01 MTC-COMM-PROC-MTH-NR PIC S9(04) COMP .
Move Group to MTC-COMM-PROC-MTH-NR.
This will serve your purpose...but ensure you have numeric field going in GROUP variable
Thanks
Cobcurious
8) |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Wed Oct 20, 2004 11:32 am Post subject: |
|
|
S9(04) COMP is half-word binary i.e. two bytes. Your source data is a total of four bytes. Are you sure, you want to do this? _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
mfjin Beginner
Joined: 26 Apr 2003 Posts: 94 Topics: 17
|
Posted: Thu Nov 18, 2004 2:05 pm Post subject: |
|
|
I know my fundamentals arent very strong but can somebody explain why a 4 byte numeric field cant be stored in a 9(04) comp field.
I ask this because if you consider a packed decimal field,
a 5 byte field say yyddd can be stored occupying 3 bytes in a 9(5) comp-3 field. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Fri Nov 19, 2004 2:01 am Post subject: |
|
|
mfjin,
A S9(1) through S9(4) COMP (Binary half-word (2 bytes)) can be used to store values ranging from -32768 through +32767
I don't see any problem in storing a 4 byte numeric into 2 byte comp field.
Check this link which explains the storage ranges of all COMP variables.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
mfjin Beginner
Joined: 26 Apr 2003 Posts: 94 Topics: 17
|
Posted: Fri Nov 19, 2004 2:28 am Post subject: |
|
|
Thanks Kolusu for affirming what I said. cogitos and ravis posts made me think otherwise.
Also, youve missed the link. Can you pls post it so that i can see what it says? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Fri Nov 19, 2004 8:57 am Post subject: |
|
|
Quote: | REQUESTED-DATE-CC PIC XX.
REQUESTED-DATE-YY PIC XX.
these 2 variable into,
MTC-COMM-PROC-MTH-NR PIC S9(04) COMP
|
Unless I'm missing something, all you need is:
Code: |
01 REQ-DATE-CCYY.
03 REQUESTED-DATE-CC PIC XX.
03 REQUESTED-DATE-YY PIC XX.
01 REQ-DATE-CCYY-NUM REDEFINES REQ-DATE-CCYY PIC 9(4).
.
.
.
MOVE REQ-DATE-CCYY-NUM TO MTC-COMM-PROC-MTH-NR.
|
|
|
Back to top |
|
|
|
|