Embedded SQL Example è  Using SQL queries directly in the program

 


 


HDEBUG(*YES)
HOPTION(*NODEBUGIO)
*
DFLD0001          S             10A   INZ('IROBO')
DFLD0002          S             12A   INZ('P00000000002')
DSQLSTMT1         S            350
*
C/EXEC SQL
C+ UPDATE PARTYD SET PNAME=:FLD0001
C+ WHERE PNUM=:FLD0002
C/END-EXEC
C                   EXSR      @EXIT
*
C/EXEC SQL
C+ INSERT INTO AMIT/ACCSUBPF VALUES
C+ (191,  'A00000000002', 'USD',  'KJDANFK',   'NKDA ' , 'P00000000007')
C/END-EXEC
C                   EXSR      @EXIT
*
*
C/EXEC SQL
C+ DELETE FROM PARTYD
C+ WHERE PNUM=:FLD0002
C/END-EXEC
C                   EXSR      @EXIT
*
C     @EXIT         BEGSR
C                   IF        SQLCOD<0
C                   GOTO      EXIT
C                   ENDIF
C                   ENDSR
C     EXIT          TAG
C                   SETON                                        LR
C*_________________________________________________
****************** End of data *************************************************

 

 

OUTPUT

 

All SQL queries will get executed.











User Comments:



Copyright © www.go4as400.com, 2013-2023. Copyright notice   Terms of services   Privacy policy