As400显示文件创建.docx

上传人:b****6 文档编号:7090712 上传时间:2023-01-17 格式:DOCX 页数:14 大小:220.12KB
下载 相关 举报
As400显示文件创建.docx_第1页
第1页 / 共14页
As400显示文件创建.docx_第2页
第2页 / 共14页
As400显示文件创建.docx_第3页
第3页 / 共14页
As400显示文件创建.docx_第4页
第4页 / 共14页
As400显示文件创建.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

As400显示文件创建.docx

《As400显示文件创建.docx》由会员分享,可在线阅读,更多相关《As400显示文件创建.docx(14页珍藏版)》请在冰豆网上搜索。

As400显示文件创建.docx

As400显示文件创建

DisplayFiles如何创建显示文件

DisplayfilesareDDSfilesthatenableustocreateAS/400menusandscreenstointeractwiththeuser.Displayfilescanhaveseveralrecords.Eachrecorddefinespartofthescreen'sappearance.Theserecordsmayormaynotoverlapeachother.

显示文件是一些帮助我们创建和用户进行交互的AS400菜单和屏幕界面的DDS文件。

显示文件能够包含多个纪录,每个记录定义了屏幕界面的一部分。

这些记录或者相互覆盖。

TheSDAapplicationallowsusto“draw”whatshouldshowuponthescreenandcreatestheDDScodefromour“drawing”.Nextwe'llcreateascreenwithDDSandafterwardwe'lllookatsomecodeexcerpts,becausesometimesit'seasiertoalterthescreenthroughitscode.

SDA程序允许我们在屏幕上“画草稿”,它会根据我们所画的“草稿”生成相应的DDS代码。

下面,我们将要创建利用DDS创建一个屏幕界面,然后查看这些代码的片断,因为,有些时候,利用代码来修改界面还是比较容易些。

Inthischapter,we'llcreateascreentoshowaclientsdata.

在这一章,我们将创建一个显示客户数据的界面。

ToopenSDAtypeSTRSDAonthesystemprompt.Thisscreenshouldappear:

在系统命令行输入STRDA就可以打开SDA程序了,如下图显示:

Chooseoption1andtypetheoptionsasyouseethemontheimagebelow.Sourcefileisthefilewherethecodewillbestored.Memberisthenameofmemberwe'recreating.

选择1,然后输入相关的选项,如下图,Sourcefile就是代码保存的文件了,在Member输入我们想要创建的成员(Member)。

Createfile创建文件

PressEnter.Anewscreenappears.Addanewrecord,namedTOP,typingwhatyouseeontheimagebellow.

按下回车键,然后我们添加记录,命名为Top,如下图

Nowspecifytherecordtype,inthiscaseit'sRECORD:

接着我们输入记录类型,在这个例子中我们输入Record

AftertheEnteranemptyscreenappears.Inthisscreenyoucan“draw”thetoprecord.Addthecontentyouseeontheimagebellow.

按下回车,现在我们就可以“草绘”top记录,添加内容了,如下图:

Whenyoutypeastringyoushouldplaceitbetweenapostrophes.Ifyoudon'teachwordwillbehandledlikeadifferentfield.Placingtheapostrophesallowsyoutomanipulateallthewordsasasinglefield.

当你想输入一个字符串的时候,请问打上单引号,假如你不这样做的话,系统会把他们当作分开的不同字符串。

The*USERfunctionshowstheusernameonthescreen.Thereareotherfunctionsthatretrieveinformationfromthesystem:

*DATE(showsthesystemcurrentdate),*TIME(showsthesystemcurrenttime),*SYSNAME(showsthesystemname).

*USER用来在屏幕上显示用户名

*DATE用来在屏幕上显示系统当前日期。

*TIME用来在屏幕上显示系统的当前时间。

*SYSNAME用来在屏幕上显示系统名称。

AftertypingwhatyouseeontheimagepressEnter.Alwayscheckwhatyou'vedonebeforepressingEnter,becauseafterthatyoucanonlyalterthescreenbymanipulatingitscode.Youcanalsoexittherecordeditingwithoutsavingyourwork,butthenyou'llloseallyou'vedonesinceyoulastopenedtherecordforediting.

按照上图输入完成后按下回车,就可以看到下图了,请在按下回车之前仔细检查,因为按下回车之后,只能用代码进行修改了,当然,你也可以退出这条记录而不保存,但是你就会丢失这些工作成果。

Movingafield移动字段

Youcanmoveafieldtotherightplacing“>”characterstotherightofthefield.Thenumberof>youtypewillbethenumberofcolumnsthefieldwillmove.Tomovethefieldtotheleftplace

你可以通过在字段右边的输入〉来使字段向后移动,你输入〉符号的数量就是字段向右移动的位移量,向左是同样的道理。

Centeringafield字段居中

Tocenterafieldonthescreenplacean'ac'attheleftofthefieldandthe'c'mustbeoverlappingthefirstcharacterofthefield.ThenpressEnter.

PressF3tofinisheditingthisrecord.Chooseoption1tosaveyourwork:

要是想将字段居中,你可以在字段的左边输入ac,c必须覆盖字段字段的第一个字符,然后按下回车,按下F3结束你对字段的编辑,选择1保存你的工作成果。

CreateanotherrecordnamedBOTTOM,thesamewayyou'vecreatedtheTOPrecord.

现在我们创建另外一个记录叫做Bottom,方法是跟创建TOP字段是一样的。

WhenyouopenthenewrecordforeditingpressF9.Thismenuwillappear:

当你打开按下F9对新的记录,我们可以看见菜单显示出来了

Sothatyoudon'toverlaptherecordsyoucanchoosetovisualizeotherrecordsinthemenu.YoucanseethatthestatusoftheBOTTOMrecordis“InUse”whichmeansitistheonecurrentlybeingedited.Youcanselectatmost3recordstovisualize.Todosoplacenumbers1to3ontherecordsyouwant.SelecttheTOPrecordandpressEnter.

为了不要覆盖你的其他记录,你可以选择在菜单中对其他记录可视化,你可以发现Bottom记录处于正在使用“InUse”状态,意味着这正是我们正在编辑的记录,你可以选择最到3条记录进行可视化,将1,2,3放在你想可视化的记录上面,然后按回车

Thenamesoftheselectedfieldsappearonthebottomofthescreen.Don'tforgetyouareonly“drawing”ontherecordinuse.Theotherrecordsonlyhelpyouplaceyourelementsontherightplace.

可以看到,你所选的字段显示在屏幕的底部了,但是你不要忘记了,你只能“草绘”那个正在使用(“InUse”)的记录,其它记录只能辅佐那个正在使用的字段放置合适的位置而已。

“Draw”somethingsimilartowhatyouseeinthenextimage.Usetheunderscoretomaketheline.

像下图那样“草绘”我们的需要的界面,我们使用下划线描述出一条直线来

Changingfieldproprieties修改字段属性

We'regoingtoedittheproprietiesofthe“F3=Exit”field.Placean'*'attheleftofthefieldandpressEnter:

我们现在修改“F3=Exit”字段的属性,在这个字段的左边输入*,然后按下回车。

Thisscreenappears.Placean'Y'intheColorsoption.We'regoingtochangethecolorofthecharacters.

当出现了下面的界面,在颜色选项中输入Y,

Placean1intheBluefield:

在蓝色选项那里输入1

Selectbluecolor选择蓝色

PressEnteruntilyou'rebackintheeditingscreen.Thefieldisnowblue.Exittheeditingscreen(F3)andsaveyourwork.

按回车返回,直至你返回编辑界面,现在可以看到字段已经变成蓝色了,按F3退出编辑界面然后保存你的工作成果。

Createanewrecord,MIDDLE,thesamewayyou'vecreatedthepreviousrecords.

创建一个新的记录,MIDDLE,方法跟你之前的事一样的

PressF9tovisualizetherecordsyoualreadycreated:

按F9可视化你刚刚创建的记录

Drawwhatyoucanseeinthefollowingimage.PressEnterwhenyou'redone.

按照下图草绘界面,完成后按回车

Addfields

添加字段

Usingtablerecords

使用表记录

We'regoingtoselectthefieldsfromtheClientstabletoshowthemonthescreen.PressF10.OnthatmenuselecttheDatabaseFileClientsforoutput(option3).Youcanalsoselectfieldsforinputorinput/outputchoosingoneoftheotheroptions.YoushouldwritethisonthemenuandpressEnter:

现在我们将要在客户表中选择我们想要的字段,将他们显示在界面上面,按下F10,现在第3项(selecttheDatabaseFileClientsforoutput),你也可以为其它的选项,选择字段作为输出和输入。

Selectthetable选择表

Onthebottomofthescreenthere'samessagewithalltheClient'sfieldnamesprecededbyanumber.Touseafieldonthescreenyoushouldwriteitscorrespondentnumberprecededwithan'&'.Youcanseeitinthenextimage.Becareful,becauseifyouwriteanumberandpressEntertheorderofthelistonthebottomwillchange.

在下图中,你可以看到一条信息显示在最下面,显示了客户表的所有字段和字面名字前面附带着号码,要将这些字段显示在界面的,你需要将相关的字段的号码写在屏幕界面上,前边带上一个‘&’的符号,如下图,

Thefinalresult:

最后结果

Exittherecordediting.Wenowneedtomakeafewadjustmentstothefileoptions.

推出记录编辑,我们需要对文件选项进行一些修改

Recordleveloptions(overlay)记录层面选项(覆盖)

Chooseoption8totheTOPrecord:

在Top记录选择选项8

Changeoverlayoption修改覆盖选项

SelectoptionOverlayKeywords:

选择覆盖关键字

Changeoverlayoptionstep2修改覆盖选项第二步

PlaceanYattheoptionOverlaywithouterasing.Thisoptionallowstodisplaythisrecordonthescreentogetherwiththeothers.PressEnteruntilyoureachthemenuwiththerecordlisting.Activatethisoptionontheotherrecords.

在选项(Overlaywithouterasing)的地方输入Y,这个选项允许你在屏幕界面中同时显示其他的记录。

一路回车直至你看到记录列表,在其他界面中激活这个选项

Changeoverlayoptionstep3

修改覆盖属性步骤3

Fileleveloptions(indicators)文件层面的选项(指示器)

Weneedtodeclaretheindicator03(sothat“F3=Exit”works)atthefilelevel.OnthemenuwiththerecordlistingpressF14(F13=shift+F1;F14=shift+F2;F15=shift+F3,etc.).OnthefollowingscreenchoosetheoptionIndicatorKeywords.

要实现“F3=Exit”的功能,我们需要需要在文件的层面声明指示器03,在字段列表的菜单中我们输入F14(F13=shift+F1;F14=shift+F2;F15=shift+F3,etc.).然后,我们选择指示器选项关键字,如下图

Insertthedatayouseeontheimagebelow:

按照下图输入

PressEnteruntilyou'vereachedthestartingmenu.PressF3andsavethefile.

一路回车直至看到开始菜单,按F3保存文件。

DisplayFilesDDScode显示DDS文件的代码

YoucancheckoutthecodefromthisdisplayatQDDSSRC,thememberisSHW_CLI.Atthebeginningofthefileshouldbesomethinglikethis:

你可以查看上面步骤产生的DDS代码,位置在QDDSSRC,成员名字是SHW_CLI,在文件的开头我们可以看到这样两行:

ADSPSIZ(2480*DS3)

ACF03(03'Exit')

Thesearethefile-leveloptions.Youshouldaddalinetothisareathatlaterwillallowyoutorenametheindicatorsused.AddthislineaftertheDSPSIZline:

这是文件层面的选项,你迟些可以在这里增加一行,它允许你重命名这个已经用了的指示器,在DSPSIZ后面添加一行,如下

AINDARA

Youshouldalsohavesomelineslikethese:

你也可以添加几行像下面的:

ARTOP

AOVERLAY

A165USER

A327'ClientDetails:

'

InthesefourlinesarethedefinitionstotheTOPrecord.NoticetheOVERLAYoptionwehaddefinedinSDA.ThekeywordUSERisplacedonthe1stline,column65.

上面四行是关于TOP记录的定义,要注意的是OVERLAY选项是我们在SDA中定义的,关键字USER被放在第一行,第65列。

LookatthislinefromMIDDLErecord:

现在我们看看MIDDLE的记录

AID_CLIRO823REFFLD(CLIENTS/ID_CLIDEMO/CLIENTS)

HereyouhaveareferencetotheID_CLIfieldontheCLIENTStableandthisreferenceispositionedatline8column23,ancanonlybeaccessedforreading(O).

这里你定义了一个引用,指向CLIENTS表的ID_CL字段,这个字段的位置在第8行,第23列,是一个只读的字段。

Compilethefile(option14)afteryou'veclosedthemember.

关闭了这个成员之后,你可以按F14编译这个文件。

Executingdisplayfiles执行显示文件

TorunthescreenyoumustcreateanRPGLEmemberwhichwillhandleallthepossibleevents(pressingF3forexample).CheckoutthefileQRPGLESRC.SHW_CLItoseehowthismembershouldbedefined.CreateafilelikeQRPGLESRC.SHW_CLIandrunit.Theresultshouldbesomethinglikethis:

要运行这个界面,你必须创建一个RPGLE成员,来处理所有可能的事件(例如按下F3),打开文件QRPGLESRC.SHW_CLI,看看我们英文怎么定义这个成员,创建一个像QRPGLESRC.SHW_CLI文件,然后我们运行,结果如下图,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > 互联网

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1