Thanks to everyone for the responses!

Turns out that the cpytostmf command was actually working just fine, but the resulting file is being replaced by a program which is being called further downstream which creates a stream file of the same data using a little rpg function that the programmer wrote themselves! I'm guessing because they were having issues with the cpytostmf at some point in the past???

On a related note, I think we need to institute very heavy fines for anyone who codes an MONMSG(CPF0000) with nothing in the EXEC() parameter!!!

Sorry for wasting your time!


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Greg Wilburn
Sent: Thursday, January 10, 2019 5:42 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Bizarre CPYTOSTMF issue

Did you try running the CLLE through debug (better yet, the entire process and debug via SEP)?

I know it's very basic... but I've had issues where the compiled object was in another library or something, and/or the source didn't match the object.

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Chris Wright
Sent: Wednesday, January 09, 2019 4:40 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Bizarre CPYTOSTMF issue

Not strictly RPG, but I've been banging my head against a wall for a week now over this one! Can anyone help????

We are copying a Physical file member to a csv document held on the ifs using CPYTOIMPF. The command is issued within a CLLE routine.

Everything was just fine - and has been for years! We got the data correctly formatted with a CRLF at the end of each line.

Then, at the beginning of December, the CRLFs stopped appearing! The Stream file is just a single record with no line breaks!

If I run the command from a command line, it still works perfectly, but from within the CL (which runs in an interactive job), no line breaks. I tried changing the command so that the ENDLINFMT parameter explicitly specifies *CRLF, but get the same result.


We are at v7 r1 of the O/S. The CL Program does a number of overrides

Any suggestions welcomed!

Chris Wright
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support by shopping at with our affiliate link:

This thread ...


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

This mailing list archive is Copyright 1997-2019 by 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].