Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Hello, Everyone! :) I have a quesiton for you regarding file transfers via FTP on a AS/400 system. I have transfered QRPGLESRC members from source system to target system successfully. I noticed that the transfer of my members did not transfer the member type or descriptions. I have my transfered members in QRPGLESRC on my target system, but I lost all the types and descriptions.
I am new to FTP, so I don't know why this happened. How do I fix this? Do I need to manual create another member with the type, and then copy and paste into that member?
Can you please help me?
Thank you,
Darren Salvis
When you use FTP to transfer source members (or any other file members), you are transferring the data only, not the member attributes. One option is to save the source members to a SAVF, FTP the SAVF (in binary), then restore. If the systems are at different releases, watch your TGTRLS on the save. On the restore side, watch OPTION and MBROPT. Also possibly FILEMBR and RSTLIB. If owner of the source *FILE objects on source and target are not the same, you'll also need ALWOBJDIF.
If both systems have ObjectConnect installed, you can do it all at once with SAVRSTOBJ. You may be able to find other free or inexpensive utilities that also do this. [Bob?]
ObjectConnect is a separately installable feature of i OS; it is free, but it is not installed by default. If you pay attention to the jobs and joblogs, what the SAVRST* commands do is bascially save to a SAVF in QTEMP, transfer that to the remote system (proprietary, not actually FTP), then restore, which is what you would be doing manually anyway.
Thanks, Dale for your assistance. My two systems are different releases. The source system is V7R1 and the target system is V5R3. I do not have authority to run RSTLIB or RSTOBJ on target system.
Checked for ObjectConnect on source system, not installed. Checked GO LICPGM on target system, but nothing shows up, so can't confirm whether ObjectConnect is installed on target system.
I guess I must do it the old fasion way, copy and paste to RPGLESRC type and SQLRPGLE source type too.
Darren
Darren,
I use my CPYSRCRMT (Copy Source to Remote System) command. It does what you want. However you MUST have DDM active for it to work. Basically it uses CPYSRCF by first setting up temp DDM files in QTEMP that point to the remote file and member. Then it just does the copy. It is in my Cozzi AppTools library so if you download the runtime version it should be there.
I use it today between a V7R1 system and remote systems running V5R4. It works on V5R4 and later. This means the command itself has to be running on v5.4 or later, but the remote system may be at any release.
Thanks for the assistance Bob. The system I am using as target system (where I am FTP'ing from) has V5R3 :(
I cannot change that, because it is a public system for users around the world (free).
Thanks anyways though,
Regards,
Darren
Well, the routine itself isn't V5R4 dependent. Let me see if the source is available...
Yep, got it. Don't worry about the v7.1 or v6.1 notes, that's release-level conditioning--so it won't run on v5.3 but it will compile on V5R3 (and probably v5r1 and later).
To compile it: CRTCMD CMD(CPYSRCRMT) PGM(CPYSRCRMT)
CPYSRCRMT: CMD PROMPT('COZZI-Copy Remote Src Mbr') PARM KWD(FROMSRC) TYPE(FROMSRC) MIN(1) + PROMPT('From source file') FROMSRC: ELEM TYPE(FROMQUAL) MIN(1) PROMPT('Source file') ELEM TYPE(*CHAR) LEN(64) DFT(*LOCAL) + SPCVAL((*LOCAL)) EXPR(*YES) + INLPMTLEN(25) PROMPT('From System') FROMQUAL: QUAL TYPE(*NAME) MIN(1) EXPR(*YES) QUAL TYPE(*NAME) DFT(*LIBL) SPCVAL((*LIBL) + (*CURLIB)) EXPR(*YES) PROMPT('From library') PARM KWD(TOSRC) TYPE(TOSRC) MIN(1) + PROMPT('To source file') TOSRC: ELEM TYPE(TOQUAL) PROMPT('Source + file') ELEM TYPE(*CHAR) LEN(64) DFT(*LOCAL) + SPCVAL((*LOCAL)) EXPR(*YES) + INLPMTLEN(25) PROMPT('To System') TOQUAL: QUAL TYPE(*NAME) DFT(*FROMSRC) SPCVAL((*FROMSRC)) + EXPR(*YES) QUAL TYPE(*NAME) DFT(*FROMLIB) SPCVAL((*FROMLIB) + (*LIBL) (*CURLIB)) EXPR(*YES) PROMPT('To + library') PARM KWD(FROMMBR) TYPE(*GENERIC) LEN(10) MIN(1) + SPCVAL((*ALL) (*FIRST)) EXPR(*YES) + PROMPT('From member') PARM KWD(TOMBR) TYPE(*NAME) LEN(10) DFT(*FROMMBR) + SPCVAL((*FROMMBR) (*FIRST)) EXPR(*YES) + PROMPT('To member') PARM KWD(MBROPT) TYPE(*CHAR) LEN(10) RSTD(*YES) + DFT(*REPLACE) SPCVAL((*ADD) (*REPLACE)) + EXPR(*YES) PROMPT('Replace or add records') PARM KWD(SRCTYPE) TYPE(*NAME) LEN(10) + DFT(*FROMMBR) SPCVAL((*SAME) (*FROMMBR)) + PROMPT('To member SEU Type (v7.1)') PARM KWD(TEXT) TYPE(*CHAR) LEN(10) RSTD(*YES) + DFT(*FROMMBR) SPCVAL((*SAME) (*FROMMBR)) + PROMPT('Text ''de!--script--ion'' (v7.1)')
To compile it: CRTBNDCL PGM(CPYSRCRMT)
CPYSRCRMT: PGM PARM(&FROMSRC &TOSRC &FROMMBR &TOMBR &MBROPT + &SRCTYPE &SRCTEXT) DCL VAR(&FROMSRC) TYPE(*CHAR) LEN(86) DCL VAR(&FROMFILE) TYPE(*CHAR) STG(*DEFINED) + LEN(10) DEFVAR(&FROMSRC 3) DCL VAR(&FROMLIB) TYPE(*CHAR) STG(*DEFINED) + LEN(10) DEFVAR(&FROMSRC 13) DCL VAR(&FROMSYS) TYPE(*CHAR) STG(*DEFINED) + LEN(64) DEFVAR(&FROMSRC 23) DCL VAR(&TOSRC) TYPE(*CHAR) LEN(86) DCL VAR(&TOFILE) TYPE(*CHAR) STG(*DEFINED) + LEN(10) DEFVAR(&TOSRC 3) DCL VAR(&TOLIB) TYPE(*CHAR) STG(*DEFINED) + LEN(10) DEFVAR(&TOSRC 13) DCL VAR(&TOSYS) TYPE(*CHAR) STG(*DEFINED) + LEN(64) DEFVAR(&TOSRC 23) DCL VAR(&FROMMBR) TYPE(*CHAR) LEN(10) DCL VAR(&TOMBR) TYPE(*CHAR) LEN(10) DCL VAR(&MBROPT) TYPE(*CHAR) LEN(10) DCL VAR(&SRCTYPE) TYPE(*CHAR) LEN(10) DCL VAR(&SRCTEXT) TYPE(*CHAR) LEN(10) DCL VAR(&VERREL) TYPE(*INT) LEN(4) DCL VAR(&PLATFORM) TYPE(*INT) LEN(4) DCL VAR(&FC) TYPE(*CHAR) LEN(12) DCL VAR(&CPYSRC) TYPE(*CHAR) LEN(512) DCL VAR(&LEN) TYPE(*DEC) LEN(5 0) DCL VAR(&CMDLEN) TYPE(*DEC) LEN(15 5) MONMSG MSGID(CPF0000) IF (&TOFILE *EQ '*FROMSRC') THEN(DO) CHGVAR VAR(&TOFILE) VALUE(&FROMFILE) ENDDO IF ((&TOLIB *EQ ' ') *OR (&TOLIB *EQ '*FROMLIB')) THEN(DO) CHGVAR VAR(&TOLIB) VALUE(&FROMLIB) ENDDO IF (&TOSYS *NE '*LOCAL') THEN(DO) CRTDDMF FILE(QTEMP/COZDDMTO) + RMTFILE(&TOLIB/&TOFILE) + RMTLOCNAME(&TOSYS *IP) CHGVAR VAR(&TOLIB) VALUE('QTEMP') CHGVAR VAR(&TOFILE) VALUE('COZDDMTO') ENDDO IF (&FROMSYS *NE '*LOCAL') THEN(DO) CRTDDMF FILE(QTEMP/COZDDMFROM) + RMTFILE(&FROMLIB/&FROMFILE) + RMTLOCNAME(&FROMSYS *IP) CHGVAR VAR(&FROMLIB) VALUE('QTEMP') CHGVAR VAR(&FROMFILE) VALUE('COZDDMFROM') ENDDO CHGVAR VAR(&FC) VALUE(X'000000000000000000000000') /* CLREPEAT VAR(&FC) VALUE(X'00') --Removed */ CALLPRC PRC('CEEGPID') PARM((&VERREL) (&PLATFORM) + (&FC)) IF (&VERREL *GE 0610) THEN(DO) /* On v6.1 or later? */ chgvar var(&cpysrc) VALUE('CPYSRCF ' + *BCAT 'FROMFILE(' *CAT &FROMLIB *TCAT '/' *CAT &FROMFILE *TCAT ')' + *BCAT 'TOFILE(' *CAT &TOLIB *TCAT '/' *CAT &TOFILE *TCAT ') ' + *BCAT 'FROMMBR(' *CAT &FROMMBR *TCAT ')' *BCAT 'TOMBR(' *CAT &TOMBR *TCAT ')' + *BCAT 'MBROPT(' *CAT &MBROPT *TCAT ')' + *BCAT 'TEXT(' *CAT &SRCTEXT *TCAT ')' + *BCAT 'SRCTYPE(' *CAT &SRCTYPE *TCAT ')') ENDDO ELSE DO chgvar var(&cpysrc) VALUE('CPYSRCF ' + *BCAT 'FROMFILE(' *CAT &FROMLIB *TCAT '/' *CAT &FROMFILE *TCAT ')' + *BCAT 'TOFILE(' *CAT &TOLIB *TCAT '/' *CAT &TOFILE *TCAT ') ' + *BCAT 'FROMMBR(' *CAT &FROMMBR *TCAT ')' *BCAT 'TOMBR(' *CAT &TOMBR *TCAT ')' + *BCAT 'MBROPT(' *CAT &MBROPT *TCAT ')') ENDDO RTVMSG MSGID(CPF9897) MSGF(QCPFMSG) MSGDTA(&CPYSRC) + MSGLEN(&LEN) CHGVAR VAR(&CMDLEN) VALUE(&LEN) IF (&LEN > 1) THEN(DO) SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) + MSGDTA(%SST(&CPYSRC 1 &LEN)) CALL PGM(QCMDEXC) PARM(&CPYSRC &CMDLEN) ENDDO DLTF FILE(QTEMP/COZDDMTO) DLTF FILE(QTEMP/COZDDMFROM) ENDPGM: ENDPGM