15 pts.
 Calling FD_Set and FD_Zero API from a COBOL/400 program?
I'm developing a socket client in COBOL/400 and I already have most of calls to Unix-type APIs, but I don't know how to call FD_Set and FD_Zero. Are the API names wrong? (for example, I had to change name "GetErrno" by "__errno". Many thanks in advance. George.

Software/Hardware used:
ASKED: June 15, 2009  4:13 PM
UPDATED: June 16, 2009  7:15 PM

Answer Wiki:
The problem that you are encountering is due to FD_SET and FD_ZERO (along with FD_CLR and FD_ISSET) not being APIs in the conventional sense. They are implemented as macros in the C header file QSYSINC/SYS,TYPES. These APIs are not called, they are imbedded into to compiled program. You will need to re-implement the "APIs" using standard COBOL operations. FD_ZERO should be easy enough, just move low values to fds for the length of a fd_set structure. FD_SET may be a bit more challenging as you're working with bits (not exactly a strong point for COBOL). You might find this <a href="http://www.brucevining.com/index.php?option=com_content&view=article&id=19:cc-working-with-bits&catid=1:online-publications&Itemid=19">article</a> to be of interest. Bruce Vining <a href="http://www.brucevining.com/">Bruce Vining Services</a>
Last Wiki Answer Submitted:  June 16, 2009  4:43 pm  by  bvining   6,055 pts.
All Answer Wiki Contributors:  bvining   6,055 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thank you very much, Bruce, it really makes sense to me and the link is very useful, too. It was very hard to find information on this kind of development. Regards. George.

 15 pts.