× 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.



I am trying out a new technique for me that involves reading, writing and updating a file in procedure using a file described in the procedure (so it doesn't mess up my main program file). It can be illustrated in the program below but it is the standard if found update otherwise write. I can't get it to compile with various RNF7701 and RNF7595 errors. Am I missing something? Do I have to define the data structure twice - once for input and once for output?

CREATE TABLE MIKETEST/MAKTEST2 (MKUSER CHAR (10 ) NOT NULL WITH  
DEFAULT, THISTIME INT NOT NULL WITH DEFAULT, PRIMARY KEY (MKUSER))



     D*--------------------------------------------------
     D* Procedure name: WriteUpdateTable
     D* Purpose:        Write and update table
     D* Returns:
     D* Parameter:      inKey => Key to files
     D*--------------------------------------------------
     D WriteUpdateTable...
     D                 PR
     D  inKey                        10A   CONST

      /free
        WriteUpdateTable('TEST');
        *inlr = *on;
      /end-free

     P*--------------------------------------------------
     P* Procedure name: WriteUpdateTable
     P* Purpose:        Write and update table
     P* Returns:
     P* Parameter:      inKey => Key to files
     P*--------------------------------------------------
     P WriteUpdateTable...
     P                 B
     Fmaktest2  uf A E           k DISK    rename(maktest2:makrec)
     F
     F
     D WriteUpdateTable...
     D                 PI
     D  inKey                        10A   CONST

     D rec1            DS                  likerec(makrec:*all)
     D
      /FREE
       chain (inKey) maktest2 rec1;
       if %found(maktest2);
         rec1.thistime += 1;
         update makrec rec1;
       else;
         rec1.mkuser = inKey;
         rec1.thistime = 1;
         write makrec rec1;
       EndIf;
      /END-FREE
     P WriteUpdateTable...
     P                 E

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.