There is no CL command to allow you do do this.
If you have the record in another file, you can use CPYF and select just that record.
Another option is is use SQL.
The recently announced PowerCL: CL for Files product has the Write Record using CLF (WRTRCDCLF) command (and also a WRITE command if you’re familiar with RPG opcodes).
CL for Files provides CL commands for the file operations you historically needed a language such as RPG, COBOL, or C to perform. The commands can be in either an ILE or an OPM CL program.
(note that my company markets this product though a simple WRTRCDCLF can be done with the no charge base support of the product)
Yes. You can use the CALL command in OPM CL or ILE CL. In ILE CL, you can also use CALLPRC. In both cases, the target will be a HLL program or procedure (or API) that can do the write for you. New commands can be created to replace CALL; they help in formatting the parms and providing [help] text. Most methods provided for giving CL ability to write to database files are such commands. (The extensibility of CL is an important part of its power.)
That is, it is possible to use APIs like _Rwrite() to cause writes to happen. (If you can do what’s needed to make _Rwrite() work effectively in CLLE, you can probably do it in CLE anyway and probably better.) However, other languages can do more database I/O natively than CL.
After all, CL is ‘Control Language’.
OTOH, there are sites that don’t have the common compilers. For those, CL is still always available as is REXX (and MI). REXX might be a little more useful since it supports SQL even when the SQL Development Kit isn’t installed. SQL is somewhat available to CL through the RUNSQLSTM command and the STRQMQRY command. STRQMQRY allows CL to pass parameter values into SQL while RUNSQLSTM can execute static statements.
CL also can pass values into Qshell commands and scripts. One useful Qshell utility is db2 which is another interface to SQL. Other Qshell utilities can also effect file updates through IFS methods.
If database I/O in CL is required, then it can be done. It’s fairly easy to obtain utilities through the internet. The above ‘PowerCL’ is a very good example. You can also create them yourself with some good understanding of CL programming. These utilities can be very handy tools. But be sure that they’re appropriate when other languages are available.