Updating a file in cl?

pts.
Tags:
AS/400
CL
Can we update a file in CL? If so how?

Answer Wiki

Thanks. We'll let you know when a new response is added.

There are a variety of ways to update a file from a CL program.

The standard i5/OS provided commands do not provide this capability, but a CLLE program can utilize the C language runtime APIs (giving CL the same capability for file IO which is found in the C language) assuming you are on V5R4. These C runtime APIs are provided as part of i5/OS independent of whether or not you have the C language compiler installed.

There are also several ways to execute a SQL function within a CL program.

Bruce Vining
Bruce Vining Services

==========================================================

As noted, the answer is “Yes.” But the answer might continue with “Why would you want to?” Using CL to update files is more troublesome and complicated than simply writing a RPG routine to do the work and calling it. If not RPG, then COBOL and sometimes even C.

If lack of compilers is the problem, then calling a REXX procedure can even be a better choice. REXX can use embedded SQL even without the SQL Development Kit installed.

Whether it <i>can</i> be done isn’t exactly the same as whether it <i>should</i> be done. Using system quirks isn’t always the best technique.

Tom

===========================================================

A few things have changed since 2007 when the question was originally posed (thanks Tom for updating this question so it’s “seen” again).

Vendor response:

With the <a href=”http://www.powercl.com/”>Control Language for Files (CLF)</a> product CL commands are now available to update records in a file (along with read, write, delete, etc — in fact, CLF provides database capabilities that are not availabe with RPG, COBOL, and/or C!).

Calling another program, rather than using a CL command, to update a record is certainly an alternative. Some though find passing, back and forth, all of the fields as parameters to be error prone and not necessarily a good use of a developers times (that is, providing the initial linkage between programs and maintenance if/when the record layout changes).

End vendor response

Bruce

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Iordache
    go here and read a little about updating files using cl ! http://search400.techtarget.com/tip/0,289483,sid3_gci1098569,00.html
    65 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following