# Thread: Binary to Decimal conversion

1. Senior Member
Join Date
Dec 1969
Posts
194

## Binary to Decimal conversion

Hi Simon, I guess you are referring to the 2-byte binary field in position 367 in the file info data structure. Unless you are using the POST opcode somewhere in your program the current line number should always be accessible in that field. By the way, if you are only using it for program internal calculations, there is no need to convert the binary value to decimal. Here is how I would define it in RPG/IV: PrtLinInfo______DS _PlCurLin_______________367___368B_0 Best regards, Carsten

2. Guest.Visitor Guest

## Binary to Decimal conversion

This is in the front of the RPG/400 Reference Book. 2.3.1.1 File Dependent Feedback Information Complete file-dependent feedback information is available in the DataManagement Guide. Refer to the section "I/O Feedback Area" and the tables on the file-dependent area in that section. To calculate the From and To positions (positions 44 through 47 and 48through 51 of the input specifications) that specify the subfields of the file-information data structure (INFDS) for the file-dependent area, use the Offset, Data Type, and Length given in the Data Management Guide and do the following calculations: From = 367 + Offset To = From - 1 + Character_Length Character_Length = Length (in bytes) For example, for the relative record number of a subfile record, the Data Management Guide gives: Offset = 9, Data Type is Binary, Length = 2 Therefore, From = 367 + 9 = 376, To = 376 - 1 + 2 = 377. ---------------------------------------------------------------------My Code Example: 0024.00 FSFC202R O E PRINTER OFLIND(*IN99) 0025.00 F INFDS(PTRFDS) 0027.00 D** DEFINE FIELD FOR PRINTER LINE COUNT 0028.00 D PTRFDS DS 0029.00 D PTRLINE 367 368B 0 0293.00 C IF FDSTAT<>'A' 0294.00 C IF PTRLINE > 55 0295.00 C EXSR OVERFLOW 0296.00 C ENDIF