View previous topic :: View next topic
|
Author |
Message |
Simma Hemanth
New User
Joined: 05 Jul 2021 Posts: 7 Location: India
|
|
|
|
Hi,
let me explain my question,
i have a COMP S9(9) length-4 value -803 . now i have convert this comp variable to character ZD.
My Expected output:
is same as above i/p value -803
Code:
Code: |
OUTREC FIELDS=(79,4,FI,TO=ZDF) |
but, i'm getting this as output - 000000080L
kindly let me know, what to do and move further
thanks in advance
Code'd for you |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2146 Location: USA
|
|
|
|
0) there is no such format in COBOL - “S9(9) length-4”
1) learn how to use code tags in your post
2) how do you expect the value (F’-803’ in Assembler) to look like after TO=ZDF - ???
3) read the SORT manual about the conversion TO=ZDF. You’ve got exactly what is described.
4) why not to run several tests with several options and values, to find out by yourself: what is wrong in your mind? |
|
Back to top |
|
|
Simma Hemanth
New User
Joined: 05 Jul 2021 Posts: 7 Location: India
|
|
|
|
Hi Sergeyken,
the field name contains picture of S9(9) COMP. , its length is 4 and it contains value -803.
this field have to be converted from comp to character
For this first I have coded as ,
Code: |
OUTREC FIELDS=(79,4,BI,TO=ZD,LENGTH=9)
|
OUTPUT -
Quote: |
Then I have used FI instead of BI
|
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2146 Location: USA
|
|
|
|
I see, you refuse to read the SORT manual about TO=ZDF…
Using BI instead of FI demonstrates that you did not read about those values, too
Hint: use parameter EDIT=(…), or Mxx - whatever you prefer
Try to run different tests with different values, and different options, to train your mind in understanding the whole picture |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2146 Location: USA
|
|
|
|
Nowadays, any admonition to begin learning something does not help...
Without a ready-to-use answer there is not a minor step forward
First of all, one needs to understand well the existing data formats, and the rules of their conversion. Something like this example:
Code: |
Value: ~~~ 803 ~~~ ~~~ -803 ~~~
COBOL: PIC S(9)9 COMP VALUE 803 VALUE -803
Assembler: DC F'803' DC F'-803'
Hex: X'00000323' X'FFFFFCDD'
Packed Dec: X'000000803C' X'000000803D'
Unpacked Dec: X'...F0F8F0C3' X'...F0F8F0D3'
TO=ZD C'000000080C' C'000000080L'
TO=ZDC C'000000080C' C'000000080L'
TO=ZDF C'0000000803' C'000000080L'
EDIT=(STTT),SIGNS=(+,-) C'+803' C'-803'
|
|
|
Back to top |
|
|
|