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



Luqman,

Let me give you a few examples in different languages and see if this
helps.   If not, please explain further.   The following are examples of
the UPDATE statement using  data structures in programs in C, COBOL and
REXX:

void main ()
{
EXEC SQL BEGIN DECLARE SECTION;
decimal(5,2) AMOUNT;
char FROM_EMPNO[7];
char TO_EMPNO[7];
EXEC SQL END DECLARE SECTION;
EXEC SQL INCLUDE SQLCA;
EXEC SQL WHENEVER SQLERROR GOTO SQLERR;
...
EXEC SQL UPDATE EMPLOYEE
SET COMM = COMM - :AMOUNT
WHERE EMPNO = :FROM_EMPNO;
EXEC SQL UPDATE EMPLOYEE
SET COMM = COMM + :AMOUNT
WHERE EMPNO = :TO_EMPNO;
FINISHED:
EXEC SQL COMMIT WORK;
return;

For example, in COBOL:
01 SAL-REC.
10 MIN-SAL PIC S9(6)V99 USAGE COMP-3.
10 AVG-SAL PIC S9(6)V99 USAGE COMP-3.
10 MAX-SAL PIC S9(6)V99 USAGE COMP-3.
01 SALTABLE.
02 SALIND PIC S9999 USAGE COMP-4 OCCURS 3 TIMES.
01 EDUC-LEVEL PIC S9999 COMP-4.
...
MOVE 20 TO EDUC-LEVEL.
...
EXEC SQL
SELECT MIN(SALARY), AVG(SALARY), MAX(SALARY)
INTO :SAL-REC:SALIND
FROM CORPDATA.EMPLOYEE
WHERE EDLEVEL>:EDUC-LEVEL
END-EXEC.

REXX:

ADDRESS '*COMMAND',
SIGNAL ON ERROR
UPDATE_STMT = 'UPDATE CORPDATA/EMPLOYEE ',     
       'SET SALARY = SALARY * ?  ',            
         'WHERE COMM >= ?          '           
         EXECSQL,                              
              'PREPARE S1 FROM :UPDATE_STMT'   
               EXECSQL,                        
              'EXECUTE S1 USING :PERCENTAGE,', 
         '                 :COMMISSION '       
           /* Commit changes */                
EXECSQL, 
    'COMMIT'

HTH,

Dave

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.