View previous topic :: View next topic |
Author |
Message |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Tue Jul 22, 2003 11:29 pm Post subject: the value of a COMP-3 |
|
|
Hi All,
We have an issue, we want to know the value of a COMP-3 stored in S9(09)V99
variable the HEX ON Value is
000370
00075C
Please let me know the answer.
Thanks in advance.
Have a Great Day. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Jul 23, 2003 5:59 am Post subject: |
|
|
Jai,
A positive value of 377.50
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Wed Jul 23, 2003 8:19 am Post subject: |
|
|
Hi Kolusu,
Thanks a lot!
Can u please tell me how you found this value(A positive value of 377.50
). Are u transferring the value to alphanumeric and then displaying it. Or anyother way of finding it. Please let me know.
Have a Great Day. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
mayuresh.tendulkar Beginner

Joined: 25 Apr 2003 Posts: 31 Topics: 6 Location: Pune
|
Posted: Wed Jul 23, 2003 9:42 am Post subject: |
|
|
Hello Jai,
There is a simple way of doing this..
When you get the hex value of this...
000370
00075C
read the above value as
0
0 as 00
3
7 as 37
7
5 as 75
0
C as 0C
Now you will get something like this
00000037750C
and then apply your pic clause to the value....ignoring the sign field (as for comp-3 variable sign is always stored in the last nibble of the field)
so you will get something like this
000000377.50
Here, the C is for the positive sign
so you get the +377.50
Hope this helps,
Regards
Mayuresh Tendulkar |
|
Back to top |
|
 |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Thu Jul 24, 2003 1:43 am Post subject: |
|
|
Thanks a lot! mayuresh for ur detailed explanation.
We need that now to be printed on a report any idea as to
how we can do it in Eazytreive?
Please let me know.
Thanks in advance. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Thu Jul 24, 2003 5:41 am Post subject: |
|
|
Jai,
The reporting feature of easytrieve automatically prints the values in character format. so you don't have to do any thing special to print the contents of a packed decimal field
Hope this helps..
cheers
kolusu |
|
Back to top |
|
 |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Thu Jul 24, 2003 10:33 pm Post subject: |
|
|
Hi Kolusu,
No, it is printing as Junk only we tried a lot..
Please let me know if you get the exact thing.
Thanks in advance. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
Tophe Beginner

Joined: 02 Dec 2002 Posts: 8 Topics: 0 Location: Tours, France
|
Posted: Fri Jul 25, 2003 1:53 am Post subject: |
|
|
Jai,
You must define this variable as packed decimal ( P data format as I remember) ...
HTH
Tophe |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Fri Jul 25, 2003 8:29 am Post subject: |
|
|
Jai,
Here is a sample easytrieve program which prints the packed decimal field in the displayable format.
Assume that I have file which has the following layout
Code: |
PART PIC X(10).
FILLER PIC X(26).
COST PIC S9(9)V9(2) USAGE COMP-3.
|
Code: |
//STEP0100 EXEC PGM=EZTPA00
//STEPLIB DD DSN=YOUR.EASYTREV.LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSSNAP DD SYSOUT=*
//CTRLRPT DD SYSOUT=*
//FILEIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SYSIN DD *
FILE FILEIN
PART 01 10 A
COST 37 06 P 2
FILE CTRLRPT PRINTER
JOB INPUT FILEIN
PRINT CTRLRPT
REPORT CTRLRPT LINESIZE 80 PAGESIZE 60 NOADJUST +
PRINTER CTRLRPT NODATE
LINE PART COST
|
Now look at the ctrlrpt in the sysout of your job and you can see that the packed decimal fields are printed out.
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Sun Jul 27, 2003 10:41 pm Post subject: |
|
|
Hi Kolusu,
Yes It prints in SYSOUT alright, but when we write in to file we have
problems.
Please let me know..
Have a Great Day. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Mon Jul 28, 2003 5:16 am Post subject: |
|
|
Jai,
Are you using the report feature?? when you use a reporting feature of easytrieve it automatically prints the packed decimal fields. Allocate a dataset for the CTRLRPT in the jcl shown above and you will be able to see the packed decimal fields printed in the dataset.
Code: |
//CTRLRPT DD DSN=YOUR OUTPUT DSN,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(X,Y),RLSE)
|
In case if you hadn't defined your output file to printer then you will not be able to see the packed decimal field value.
why don't you post your code and I will take a look at it.
Kolusu |
|
Back to top |
|
 |
Jai Beginner
Joined: 06 Jun 2003 Posts: 57 Topics: 20
|
Posted: Mon Jul 28, 2003 10:45 pm Post subject: |
|
|
Hi Kolusu,
Pls find the code pasted below:
Code: |
//TATAJBHT JOB KBCSIE0000,'EZEE',MSGCLASS=X,CLASS=5,
// NOTIFY=TATAJBH
//EZYSTP20 EXEC PGM=EZTPA00,COND=(4,LT)
//EZTVRM DD UNIT=SYSDA,SPACE=(CYL,(10,5),RLSE)
//EZTVFM DD UNIT=SYSDA,SPACE=(CYL,(10,5),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//INFILE DD DSN=TATAJBH.COMP.INP,DISP=SHR
//OUTFILE DD DSN=TATAJBH.COMP.OUT,DISP=SHR
//SYSIN DD *
FILE INFILE
I-CHECK-AMT 1 13 N
*
FILE OUTFILE
O-CHECK-AMT 1 13 N MASK 'ZZZZZZZZZZZ.99-'
*
WS-EOF W 1 A VALUE 'N'
WS-CHECK-AMT W 13 N
* WS-CHECK-AMT W 6 N
* WS-CHECK-AMT1 W 13 N MASK 'ZZZZZZZZZZZ.99-'
*
JOB INPUT NULL
* MOVE I-CHECK-AMT TO WS-CHECK-AMT
DO WHILE WS-EOF EQ 'N'
PERFORM PROCESS-PARA
END-DO
*
PROCESS-PARA. PROC.
GET INFILE
IF EOF INFILE
DISPLAY 'EOF FILE REACHED'
STOP
ELSE
MOVE I-CHECK-AMT TO WS-CHECK-AMT
* MOVE WS-CHECK-AMT1 TO O-CHECK-AMT
PUTFILE
DISPLAY 'I-CHECK-AMT ' I-CHECK-AMT
DISPLAY 'WS-CHECK-AMT ' WS-CHECK-AMT
* DISPLAY 'WS-CHECK-AMT1 ' WS-CHECK-AMT1
* MOVE I-CHECK-AMT TO O-CHECK-AMT
* MOVE WS-CHECK-AMT TO O-CHECK-AMT
END-IF
END-PROC.
/*
Input Values in TATAJBH.COMP.INP.
000000000000{
000000005712J
000000040990G
000000180951H
Output Values in TATAJBH.COMP.OUT.
000000000000{
000000005712J
000000040990G
000000180951H
************************
|
Thanks in advance. _________________ Have a Great Day.
Thanks & Regards,
Jai |
|
Back to top |
|
 |
mayuresh.tendulkar Beginner

Joined: 25 Apr 2003 Posts: 31 Topics: 6 Location: Pune
|
Posted: Tue Jul 29, 2003 2:16 am Post subject: |
|
|
Hello Jai,
I think here the problem is due to the negative values. not because of the conversion error.
Here Since the value is negative, and you are not providing any space to show the negative sign, the sign is appended to the last byte.
To overcome this problem, do the following:
Treat this field as a numeric edited field..
O-CHECK-AMT 1 13 N MASK 'ZZZZZZZZZZZ.99-'
define it as
O-CHECK-AMT-SIGN 1 1 A
O-CHECK-AMT 2 13 N
Then while populating the value, just do the following
check for
O-CHECK-AMT-SIGN = ' '
if I-CHECK-AMT < 0
O-CHECK-AMT-SIGN = '-'
O-CHECK-AMT = I-CHECK-AMT * -1
else
O-CHECK-AMT = I-CHECK-AMT
end if
this will negate the value of the I-CHECK-AMT
AND THE LAST BYTE SIGN field will be removed.
Let me know if this doesn't helps
Regards
Mayuresh Tendulkar |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Tue Jul 29, 2003 2:39 pm Post subject: |
|
|
Jai,
The data you have shown is not packed decimal format. It is a zoned decimal format. A packed decimal format field is declared as "P" in easytrieve.
Check the following the program for displaying the values.I used redefine clause for W-CHECK-AMT.
Code: |
FILE FILEIN
CHECK-AMT 01 13 N 2
W-CHECK-AMT W 13 N 2
W-CHECK-AMT-WHOLE W-CHECK-AMT 11 N 0
W-CHECK-AMT-DEC W-CHECK-AMT +11 02 N 0
FILE FILEOUT FB(0 0)
OUT-CHECK-AMT-WHOLE 01 11 A
OUT-CHECK-AMT-DPOINT 12 01 A
OUT-CHECK-AMT-DECIMAL 13 02 N
OUT-CHECK-AMT-SIGN 15 01 A
JOB INPUT FILEIN
W-CHECK-AMT = CHECK-AMT
OUT-CHECK-AMT-WHOLE = W-CHECK-AMT-WHOLE
OUT-CHECK-AMT-DPOINT = '.'
OUT-CHECK-AMT-DECIMAL = W-CHECK-AMT-DEC
IF W-CHECK-AMT < 0
OUT-CHECK-AMT-SIGN = '-'
ELSE
OUT-CHECK-AMT-SIGN = ' '
END-IF
PUT FILEOUT
|
Hope this helps...
cheers
kolusu |
|
Back to top |
|
 |
raja_here Beginner
Joined: 23 May 2007 Posts: 7 Topics: 2
|
Posted: Tue Jun 10, 2008 12:20 am Post subject: |
|
|
Hi Kolusu,
It seems mask is of no use in eazytrieve!
Please correct me if I am wrong.
An example if provided will be a great help. Thanks in advance. _________________ Thanks,
Raja P. |
|
Back to top |
|
 |
|
|