## Conversion of Binary to Decimal

IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

### Conversion of Binary to Decimal

I have a file and file declared in SAS as follows.
@01 panelist ib4.
@05 system   ib2.
@07 units    rb4.
@11 dealbits pib1.
@12 footprnt pib2

Now I need to convert all of these into decimal using DFORT. Can you please provide the OUTREC FIELDS.
abejacb

Posts: 3
Joined: Mon Dec 21, 2020 12:05 am
Has thanked: 0 time
Been thanked: 0 time

### Re: Conversion of Binary to Decimal

What do you mean by “decimal” in this context?

Note: it could be
P’1234’=X’01234C’
Z’1234’=X’F1F2F3C4’
C’1234’=X’F1F2F3F4’
... and many others...
Javas and Pythons come and go, but JCL and SORT stay forever.

sergeyken

Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

### Re: Conversion of Binary to Decimal

Please give sample input/output. Use code tags when posting code and data so that everything aligns and is easier to read.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator

Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

### Re: Conversion of Binary to Decimal

Thanks for the quick response.

Example : if the variable is declared as 9(04) comp, I need to get it converted to 9(04) using DFSORT.
abejacb

Posts: 3
Joined: Mon Dec 21, 2020 12:05 am
Has thanked: 0 time
Been thanked: 0 time

### Re: Conversion of Binary to Decimal

abejacb wrote:Thanks for the quick response.

Example : if the variable is declared as 9(04) comp, I need to get it converted to 9(04) using DFSORT.

I recommend you to start from reading manuals rather than writing to forums...

... BUILD=(...,pos,2,BI,TO=ZD,LENGTH=4,...)
Javas and Pythons come and go, but JCL and SORT stay forever.

sergeyken

Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times

### Re: Conversion of Binary to Decimal

Look in the manual at INREC / Reformatting / Example 4 as a start point
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator

Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

### Re: Conversion of Binary to Decimal

Thanks NicC and Sergeyken.
abejacb

Posts: 3
Joined: Mon Dec 21, 2020 12:05 am
Has thanked: 0 time
Been thanked: 0 time

### Re: Conversion of Binary to Decimal

abejacb wrote:Thanks NicC and Sergeyken.

Anyway, I strictly recommend you to read manuals, carefully. There are hundreds, or thousands other tips and tricks you could learn, besides of those few answers to specific questions you can get at the forum.
Javas and Pythons come and go, but JCL and SORT stay forever.

sergeyken

Posts: 409
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times