Dear All,
I have a CL program that calls an RPGSQLE program.
The RPG program generates two files [hdrfile and dtafile]
The CL program should copy the two files to IFS using CPYTOIMPF
The problem is the CL runs fine only the first time. The second time I got:
No records copied from file HDRFILE in MYLIB
CPF2817 received by procedure CLPGM
When I check the HDRFILE, I find that there is one record inside it (which is correct) ...
Can you please advise me why the stmt below is giving this exception msg CPF2817 - and how can I solve this ?
CPYTOIMPF FROMFILE(HDRFILE) +
TOSTMF(&FILENAME) MBROPT(*ADD) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF)
Please find the code of the 2 programs below
Thanks you in advance,
Dina
RPGPGM
=========
C/Exec SQL
C+ Set Option Commit=*NONE, DatFmt=*ISO, DynUsrPrf=*Owner, DlyPrp=*YES
C/End-Exec
C/EXEC SQL
C+ drop table mylib/hdrfile
C/END-EXEC
C/EXEC SQL
C+ create table mylib/hdrfile as
C+ (select 'EMP_NAME' as col01,
C+ 'Birth_date' as col02,
C+ 'Male/Female' as col03,
C+ 'Hire_date' as col04
C+ from qsqptabl)
C+ with data
C/END-EXEC
C/EXEC SQL
C+ drop table mylib/dtafile
C/END-EXEC
C/EXEC SQL
C+ create table mylib/dtafile as (
C+ select fld1,
C+ fld2,
C+ fld3,
C+ fld4
C+ from prodtab )
C+ with data
C/END-EXEC
C seton lr
CL PROGRAM
============
PGM
DCL VAR(&FILENAME) TYPE(*CHAR) LEN(100) +
VALUE('/HOME/REPORTS/REP1')
CALL PGM(RPGPGM)
CHGVAR VAR(&FILENAME) VALUE(&FILENAME *TCAT '.CSV')
CPYTOIMPF FROMFILE(HDRFILE) +
TOSTMF(&FILENAME) MBROPT(*REPLACE) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF)
CPYTOIMPF FROMFILE(DTAFILE) +
TOSTMF(&FILENAME) MBROPT(*ADD) +
STMFCODPAG(*PCASCII) RCDDLM(*CRLF)
RCLRSC
CHGAUT OBJ(&FILENAME) USER(*PUBLIC) DTAAUT(*R)
ENDPGM
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969
As an Amazon Associate we earn from qualifying purchases.