View previous topic :: View next topic
|
Author |
Message |
Hritam
New User
Joined: 27 Jun 2005 Posts: 36 Location: India
|
|
|
|
Hi,
I have the variable as below in my detail record:
Var1 PIC S9(09) COMP.
Which needs to be added for each detail records in the file and then provide the total in the trailer as
Var2 PIC S9(12) COMP-3.
Please let me know how will I do that.
Thanks,
Ritam Dutta |
|
Back to top |
|
|
Hritam
New User
Joined: 27 Jun 2005 Posts: 36 Location: India
|
|
|
|
Although I think the requirement is clear enough, this is what I want.
Detail record of an I/P file is having a field:
VAR1 PIC S9(09) COMP.
For each detail record we need to add this field and display in the O/P file as trailer in the field:
Var2 PIC S9(12) COMP-3.
something lilke:
ADD VAR1 to VAR2.
Let me know if you have any further question.
Thanks....... |
|
Back to top |
|
|
Kevin Wailes
New User
Joined: 29 Aug 2008 Posts: 10 Location: UK
|
|
|
|
Hi
I reckon you've answered your own question....
ADD VAR1 TO VAR2
shoudl work fine. |
|
Back to top |
|
|
Cristopher
New User
Joined: 31 Jul 2008 Posts: 53 Location: NY
|
|
|
|
Hello,
i reckon you can use compute and move statement to get the required output. something like this :
Code: |
COMPUTE VAR1-T = VAR1-T + VAR1-DTL1
Keep adding for every detail record
At the end
Move VAR1-T TO VAR2-TRAIL
|
Cris |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Note that PIC S9(12) COMP-3 only allows 6 1/2 Bytes of the allocated 7-Bytes for the actual numeric data, so erroneously, you could get high-order truncation or an overflow.
For sign-fullwords, the maximum positive decimal value is 2147483647.
So, define the S9(12) COMP-3 field as PIC S9(13) COMP-3 and this will allow the high-order 4-Bits of the 1st-Byte to be used.
Other than PIC S9(18) COMP-3 (not ARITH=EXTEND) for whole number definitions (no implied decimal), odd-number picture clauses for COMP-3 fields are the preference. Why restrict the field capacity with an even-number in the picture when the storage requirements are the same?
Just my .02 cents....
Regards,
Bill |
|
Back to top |
|
|
|