Informix/4GL数据库查寻中的翻屏编程技巧


informix-4GL是一个综合性的第四代应用程序开发和生成环境,它具有强大的数据库管理功能,编程灵活方便,界面友好,已被广泛应用于UNIX操作系统下的数据库管理。下面介绍一段借助屏幕表格完成查询的小程序,它可通过在屏幕上相应字段输入模糊查询条件,如*、=、?等,据此搜索出满足条件的全部记录,再按Ctrl-F或Ctrl-B分屏浏览(调用一个游标管理函数que_gz ),用上下光标键并结合Esc键选择所需记录,再通过内部函数arr_curr()将此记录所包括的信息传出它用,在实际工作中可将此段程序写成函数形式,简洁明快,需要时只要改写相应变量即可,省时省力。此段程序在SCO UNIX Open Sever5.05、online7.3上编译通过。

程序清单:

屏幕格式:

database 数据库名

screen

{

人员代码 [a ]

人员姓名 [b ]

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

人员代码 人员姓名 工 资

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

[f000 ] [f001 ] [f002 ]

}

end

tables

gz

attributes

a=gz.xh,autonext;

b=gz.xm,autonext;

f000=formonly.xh type char;

f001=formonly.xm type char;

f002=formonly.gz type decimal(6,2);

end

instructions

screen record s_gz7

gz库表结构:

序号:xh char(6)

姓名:xm char(8)

工资:gz decimal(7,2)

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus