Calling FD_Set and FD_Zero API from a COBOL/400 program?

15 pts.
Tags:
API
COBOL/400
FD_Set
FD_Zero
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.
ASKED: June 15, 2009  4:13 PM
UPDATED: June 16, 2009  7:15 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

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>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • GeorgeFX
    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 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following