Page 1 of 1

Can we convert char into packed decimal using sort?

Posted: Sat May 27, 2023 12:42 am
by Rahul
Hi,

Can we convert char into packed decimal using sort?

Re: Can we convert char into packed decimal using sort?

Posted: Sat May 27, 2023 5:51 pm
by Anuj Dhawan
The short answer is - yes!

Re: Can we convert char into packed decimal using sort?

Posted: Wed May 31, 2023 9:44 pm
by Rahul
Sorry for the confusion, I was looking for a way to add the odd and even number to the records. it will help me to further develop a strategy.

Re: Can we convert char into packed decimal using sort?

Posted: Thu Jun 01, 2023 5:59 pm
by Anuj Dhawan
Since you haven't given any real details about what PIC clause you might be using to define the 'character' - assuming it's PIC X(10) and assuming them as ZD is safe. In that case, you would use SORT control statements something like this where p is the starting position of the field:

Code: Select all

OPTION COPY
    INREC BUILD=(p,10,ZD,TO=PD)

Re: Can we convert char into packed decimal using sort?

Posted: Mon Jun 12, 2023 10:58 am
by Rahul
Thanks Anuj, I have adapted the given solution and it seems to work for me.