Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

reg dataset declarations...

Former Member
0 Likes
362

hi all,

i have a doubt in declaring dataset. i have 2 fields with,

PIC S999999V99 SIGN TRAILING SEPARATE,

PIC S999999V99 SIGN TRAILING SEPARATE,

im using ,

OPEN DATASET gv_unixfile FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

if i use that field,

TAX_1(6) type p DECIMALS 2,

TAX_2(6) type p DECIMALS 2.

The program goes for a DUMP. but if use ,

TAX_1(6) type c,

TAX_2(6) type c.

it's working fine but in the file iam able to see 0.00 but my requirement is i need 00000000+45658950

Can anyone help me in this issue,

Thanks in Advance,

Prem.

2 REPLIES 2
Read only

Former Member
0 Likes
339

Hi

Moving decimal (packed) values to CHAR field always works. Take care that the CHAR field is long enough so that value does not get truncated.

The way back from CHAR to decimal field works if the numbers are in numeric format. You can try with

TRY.

<decimalfield> = <charfield>..

CATCH cx_sy_conversion_no_number CONVT_OVERFLOW.

ENDTRY.

OR use

open dataset fnam for input in legacy text mode code page '1100'.

Sri

Read only

Former Member
0 Likes
339

While passing the amounts / quantities to file, you need to pass values to Character field. Here you are using Type P whose size is 11. That value you are trying to pass in a character variable of size 6.

Change Character variable size value to 11 and check again.