I use the following trick when I need data file manipulation from CL.
1. Write a RPG program called EXECSQL that executes dynamic SQL statements.
2. Write a command called EXECSQL to pass a SQL statement to the program.
Now, you can use a CL command like this:
chgvar &insert ('insert into yourfile values(''' || &MSGDTA || ''')'
execsql stmt(&insert)
Full source is at
http://search400.techtarge
ShalomC
Main Topics
Browse All Topics





by: murphey2Posted on 2003-04-24 at 09:14:22ID: 8389688
Hi barrygg,
********** ***** ********** ********
I'm almost sure that ther is no option to write a file directly from CL, I needed this more than once in the past years, and searched for it in manuals and internet, but all solutions that I found is writing a simple 5 line RPG program or download some 400/tool that tells you that it can write a record from CL, but actualy including a rpg or cobol or whatevr program that will do it for you.
I don't know if you are familiair with RPG but a RPG program that wil do it can be simple as this:
*************** Beginning of data **************************
FMYFILE O F 256 DISK A
C *ENTRY PLIST
C PARM MSG 256
C EXCPT
C SETON LR
OMYFILE EADD
O MSG
****************** End of data **************************
you can call it with call PGM(MYPROG) PARM(&MSGDTA)
I realize this is not the most beautiful way, but you only have to define a file "MYFILE" and that's it.
Of cause you can extend it with external described or diferent length etc. but this is the idea!!
Have Fun