× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




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.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.