Samples of VISION:Builder application application with native DB2 SELECT statements coded within the VISION:Builder Advanced Syntax Language (ASL) File statements.
The following is an example of a simple VISION:Builder application with native DB2 SELECT statements coded within the VISION:Builder Advanced Syntax Language (ASL) File statements. Notice how the ASL is coded in easy-to-read, English-like, statements. The shaded area depicts the embedded DB2 SELECT statement.
; ASL Run Control Group for Sample Application
; Application uses a Master File
CONTROL TERM, DB2 D61A INM4CALL, RPTMSGS NO
FILE REPORT
; Declare Master file with File Definition from SQL clause
FILE MASTER INPUT, KEYS NONE,
SQL "SELECT EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT, ", "BIRTHDATE, HIREDATE, SALARY FROM DSN8610.EMP " |
;
; End of ASL Run Control
;
; Begin ASL Procedure Group
; The first procedure contains processing logic and a report
; A second report is added that outputs data in CSV format
;
PROC INFO 'Main Procedure'
NAME: FIELD V 22 ;Temporary field to hold combined name
;
; Combine Elements of Name into One Field
COMBINE LASTNAME ',', BLANKS 0, STORE T.NAME
COMBINE T.NAME FIRSTNME MIDINIT, BLANKS 1, STORE T.NAME
;
REPORT EMPNO, T.NAME, BIRTHDATE
TITLE 'Report Showing Birth Dates of all Employees'
ORDER BY EMPNO
;Use LE Picture to display Birth Date with Day of Week
ITEM BIRTHDATE PIC P'Wwwwwwwwwz, Mmm DD, YYYY'
FORMAT DATEFMT DATE, WIDTH 80
END REPORT
;
END PROC
;
REPORT BIRTHDATE HIREDATE SALARY
FORMAT METHOD CSV, DDNAME CSVOUT1
END REPORT
;
; End of Application