Use as follows:
PTSTSOCKET HOST(<hostname>) PORT(<portnumber>)
e.g.
PTSTSOCKET HOST(PACIFIC6) PORT(1352)
or
PTSTSOCKET HOST('172.17.1.6') PORT(1352)
If successful, a completion message will be returned, e.g.
Connection successfully obtained to 172.17.1.6 on port 1352
Otherwise, an appropriate escape message will be returned, e.g.
Host CAT32 name resolved but no connection was possible on port 1352
or
Host CAT37 not found
If you would like to use this on another system, you need to ship the following objects (in library PACIFIC on CAT32):
PTSTSOCKET *CMD
PTSTSOCKET *PGM
PTSTSOCKET *MSGF
and the following IFS file (which needs to go into this same folder on the destination system):
/qibm/proddata/java400/TestSocketSimple.class
Source code:
PTSTSOCKET CMD code
PTSTSOCKET RPG code
PSNDMSG CL module
TestSocketSimple Java code
11 May 09 - I now realise I didn't document how to compile the source code (or, indeed, how to build the message file). Here it is (assuming current library set appropriately):
1. Compile RPGLE and CLLE modules from PDM (option 15) and compile CMD from PDM (option 14), setting CPP for command to PTSTSOCKET.
2. Compile Java code using javac from QSH. Copy .class into /QIBM/ProdData/Java400 [this is not best practice, will sort out classpath issues & document how to do it properly at some point].
3. CRTPGM PGM(PTSTSOCKET) MODULE(PTSTSOCKET PSNDMSG)
4. CRTMSGF PTSTSOCKET
5. ADDMSGD MSGID(PTS0001) MSGF(PTSTSOCKET) MSG('Connection successfully obtained to &1 on port &2') FMT((*CHAR 256) (*DEC 5 0))
6. ADDMSGD MSGID(PTS1002) MSGF(PTSTSOCKET) MSG('Host &1 not found') SECLVL(*NONE) SEV(20) FMT((*CHAR 256) (*DEC 5 0))
7. ADDMSGD MSGID(PTS1003) MSGF(PTSTSOCKET) MSG('Host &1 name resolved but no connection was possible on port &2') SECLVL(*NONE) SEV(20) FMT((*CHAR 256) (*DEC 5 0))
Comments (0)
You don't have permission to comment on this page.