The iSeries has come a long way in its ability to handle communications. Although it handles IP communications well, there are a lot of synchronous modems still in existence and a lot of SDLC dial-up connections still around. If you're using one of those methods, then this tip is for you.
This is a command built around a file transfer API. This works well for transferring files over an SDLC connection and is faster than using SNADS or DDM. It's also an easy way to transfer files on the fly. Once you have a connection established, you can then use this command to do the rest.
A couple notes about this command. The remoteloc parameter can be found by doing DSPNETA on the remote system. That command assumes that the user name you are signed on with also exists on the remote system. Given a choice, I much prefer IP connections and FTP. But if you have to do an SDLC connection, then this works pretty well.
CMD PROMPT('Start File Transfer Support')
PARM KWD(REMOTELOC) TYPE(*CHAR) LEN(10) MIN(1) +
PROMPT('Target system name')
PARM KWD(OPTION) TYPE(*CHAR) LEN(1) MIN(1) +
CHOICE('S, R') PROMPT('(S)end or (R)eceive)')
PARM KWD(FROMFILE) TYPE(QUAL1) MIN(1) +
PROMPT('From file')
PARM KWD(FROMMBR) TYPE(*CHAR) LEN(10) MIN(1) +
PROMPT('From member')
PARM KWD(TOFILE) TYPE(QUAL2) MIN(1) +
PROMPT('To file')
PARM KWD(TOMBR) TYPE(*CHAR) LEN(10) DFT(*FROMMBR) +
SPCVAL((*FROMMBR *FROMMBR)) MIN(0) +
PROMPT('To member')
PARM KWD(REPLACE) TYPE(*CHAR) LEN(8) RSTD(*YES) +
DFT(*REPLACE) VALUES(*REPLACE *ADD) +
SPCVAL((*REPLACE Y) (*ADD N)) +
CHOICE('*REPLACE, *ADD') PROMPT('Replace +
or add records')
PARM KWD(PASSWORD) TYPE(*CHAR) LEN(10) MIN(1) +
PROMPT('Password for remote system')
QUAL1: QUAL TYPE(*NAME) LEN(10)
QUAL TYPE(*NAME) LEN(10) PROMPT('Library name')
QUAL2: QUAL TYPE(*NAME) LEN(10)
QUAL TYPE(*NAME) LEN(10) PROMPT('Library name')
PGM PARM(&RMTLOCNAME &OPTION &FROMFL &FROMMBR &TOFL +
&TOMBR &REPLACE &PASSWORD)
DCL VAR(&OPTION) TYPE(*CHAR) LEN(1)
DCL VAR(&FROMLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&FROMFL ) TYPE(*CHAR) LEN(20)
DCL VAR(&FROMFILE) TYPE(*CHAR) LEN(10)
DCL VAR(&FROMMBR) TYPE(*CHAR) LEN(10)
DCL VAR(&TYPE ) TYPE(*CHAR) LEN(6)
DCL VAR(&TOFL ) TYPE(*CHAR) LEN(20)
DCL VAR(&TOLIB ) TYPE(*CHAR) LEN(10)
DCL VAR(&TOFILE ) TYPE(*CHAR) LEN(10)
DCL VAR(&TOMBR ) TYPE(*CHAR) LEN(10)
DCL VAR(&TODATE ) TYPE(*CHAR) LEN(6)
DCL VAR(&REPLACE) TYPE(*CHAR) LEN(1)
DCL VAR(&RMTLOCNAME) TYPE(*CHAR) LEN(10)
DCL VAR(&PASSWORD) TYPE(*CHAR) LEN(10)
DCL VAR(&RTNCODE) TYPE(*CHAR) LEN(1)
DCL VAR(&MESSAGE) TYPE(*CHAR) LEN(8)
DCL VAR(&RTC) TYPE(*CHAR) LEN(1)
IF COND(&TOMBR = '*FROMMBR') THEN(CHGVAR +
VAR(&TOMBR) VALUE(&FROMMBR))
CHGVAR VAR(&FROMFILE) VALUE(%SST(&FROMFL 1 10))
CHGVAR VAR(&FROMLIB ) VALUE(%SST(&FROMFL 11 10))
CHGVAR VAR(&TOFILE ) VALUE(%SST(&TOFL 1 10))
CHGVAR VAR(&TOLIB ) VALUE(%SST(&TOFL 11 10))
CALL QY2FTML PARM(&OPTION &FROMLIB &FROMFILE +
&FROMMBR &TYPE &TOLIB &TOFILE &TOMBR +
&TODATE &REPLACE &RMTLOCNAME &PASSWORD +
&RTNCODE &MESSAGE)
IF (&RTNCODE = '0') THEN(DO)
SNDPGMMSG MSG('File Transfer completed normally.')
GOTO ENDPGM
ENDDO
IF (&RTNCODE = '1') THEN(DO)
SNDPGMMSG MSG('File Transfer ended abnormally because +
of error on local system. Message ID' +
*bcat &message)
GOTO ENDPGM
ENDDO
IF (&RTNCODE = '2') THEN(DO)
SNDPGMMSG MSG('File Transfer ended abnormally because +
of error on remote system. Message ID' +
*bcat &message)
GOTO ENDPGM
ENDDO
ENDPGM: ENDPGM
---------------------------
About the author: Tim is vice president of Technical Services at Interlink Technologies in Maumee, Ohio, where he serves as chief architect for their warehouse management system. He has worked in the banking, insurance, healthcare and distribution industries in various positions, including programmer/analyst, systems analyst and DP manager. Tim has worked on IBM midrange platforms since 1983.
==================================
MORE INFORMATION
==================================
- Setting up a dial-up connection
This user needed to set up a dial-up connection to a credit-card processing company from their iSeries to send/receive transaction files using FTP daily. The problem was the credit-card company does not support a PPP line, so it has to be a regular dial-up connection (56k). How will the FTP process know to go over the line and not through our Internet connection? Site expert Tim Granatir had some advice.
- Set up a dial-in line to an iSeries
Frank was trying to set up a dial-in line through a phone line to an iSeries. However, when he tries to dial in from home, the modem doesn't respond and the iSeries doesn't respond to the modem. What was he doing wrong? Site expert Tim Granatir helped him sort it out.
- Connect two servers using finance communications
Is it possible o have two servers connected using finance communications? Yes, says site expert John Brandt, and he tells you how.