in

CL - Can I use a Decimal Variable as a String?

I have a decimal variable declared that I would like to write to the LDA.  I am getting an error stating that the Variable is not of the correct type for the CHGDTAARA command.  Is there some way to convert the Decimal variable to a usable string so that I can write it to the LDA?

Here are the relevant lines in my program:
DCL        VAR(&COPIES)  TYPE(*DEC)  LEN(3 0)
...
CHGDTAARA  DTAARA(*LDA (302 03)) VALUE(&COPIES)
Movie Stars

Solution: CL - Can I use a Decimal Variable as a String?

hi,

You can convert the *DEC to *CHAR in a simple way:
DCL        VAR(&COPIES)  TYPE(*DEC)  LEN(3 0)
DCL &COPIESCHR *CHAR 3
CHGVAR &COPIESCHR &COPIES
...
CHGDTAARA  DTAARA(*LDA (302 03)) VALUE(&COPIESCHR)


cheers,
dd