The Lightsabre Project ====================== Part 002 - Getting Started With the COBOL compiler and assembler verified as working, things were looking pretty rosy in the lightsabre garden. Real life intervened last weekend unfortunately, so I was limited to reading the sockets API documentation until I could get a decent amount of keyboard time in. I got chance to spend a few hours on coding today, thanks to some time off after working the weekend. And I'm happy to announce I've actually made some progress - my gopher client now speaks TCP/IP! (cue wild cheers and applause) Here's a screenshot of things as they stand: ********************************* TOP OF DATA ********************************** gopher for mvs initializing sockets api getting foreign host IP hostname-value gopher.floodgap.com hostname-length 0019 hostaddr-value 18206629 getting socket connecting to remote server... closing socket terminating sockets api done! ******************************** BOTTOM OF DATA ******************************** --- OK, the UI could do with a bit of polish, but I'm fairly happy that things are heading in the right direction. My JCL to compile and run the code needed an addition to allow the linker to pull in the sockets library: //LEEGCLG JOB ,'LEE',CLASS=A,MSGCLASS=H,MSGLEVEL=(1,1) //STEP1 EXEC PROC=IGYWCLG,PARM.COBOL='XREF,FLAG(I,E)' //COBOL.SYSIN DD DSN=LEE.GOPHER.COBOL(GOPHER),DISP=SHR //COBOL.SYSOUT DD SYSOUT=* //LKED.SYSLIB DD DSNAME=&LIBPRFX..SCEELKED,DISP=SHR // DD DSN=TCPIP.SEZATCP(EZACICAL),DISP=SHR (you can see the TCPIP bit at the bottom) but other than that, things are more-or-less working as described in the documentation. The more eagle-eyed or zealous sundogs among you will have immediately leapt on one particular item in the client output: hostname-value gopher.floodgap.com Let me explain. It seems that the TCP/IP stack I'm using (IBM Communications Server) is... well... it's 'heirloom' shall we say? The software dates to around the mid-to-late 90s. The sockets library (EZASOKET) provides a 'gethostbyname' function[1] like pretty much any IP stack since Methuselah was a lad. However, for reasons best known to the designers, instead of using (what the docs admit is 'the standard') a 255-character field for the host name you're querying, it uses a 24-character field[2]. Twenty-four. The native C call naturally lets you provide a character pointer for this, but whoever did the CALL (ie. non-C) interface work was clearly of the '640K is enough for anyone' school. So, querying the host I wanted to use - 'republic.circumlunar.space' is a non-starter (agonizingly 2 characters over my buffer limit). This being the case, I've got two choices: 1. Write my own COBOL-callable 'gethostbyname' routine in C, and link to that. 2. Ignore it for the time being. Guess which one I'm going with? [1] https://www.ibm.com/support/libraryserver/BOOKS/F1AF2030/3.1.9.13?SHELF=F1A0BK0A&DT=20000531171939 [2] https://www.ibm.com/support/libraryserver/BOOKS/F1AF2030/3.4.7.8?SHELF=F1A0BK0A&DT=20000531171939