ADDRTGE SBSD(QSYS/QSYSWRK) SEQNBR(2517) CMPVAL('QCMDI' 1) PGM(QSYS/QCMD) CLS(QSYS/QSYSCLS20) - 娉ㄦ剰: Telnet鏈嶅姟鍜?span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">QTVDEVICE浣滀笟蹇呴』緇撴潫錛岀郴緇熼噸鍚悗錛屼紭鍏堢駭鎵嶈兘鏀瑰彉銆?/span> - Additional Information: - Previous to the PTFs being applied the QTVDEVICE jobs are submitted with a compare value of QCMDI. If the performance issues occurred, the circumvention noted above was to add a Routing Entry with a compare value for QCMDI that will reference a Class with a higher run priority. A drawback to this is that other jobs, the Pass-through server for example, are submitted to the QSYSWRK subsystem with a compare value of QCMDI. So the QCMDI Routing Entry affected more than just Telnet. - Mindful of the potential side effects of the first circumvention, a unique compare value of TELNETD was added to the QTVDEVICE job submission via PTF. This allows the run priority of the Telnet QTVDEVICE jobs to be changed without affecting any other programs. A real consideration with these PTFs, which are on the current Cumulative Packages, is that if you previously had added the QCMDI Routing Entry to address this issue, and the new Routing Entry is not added, the same performance lags that were experienced before will reappear. - If you had previously added the QCMDI Routing Entry at sequence number 2517, the recommendation is to remove that Routing Entry and add the one for TELNETD at sequence number 2517. Because in future releases of OS/400 the install of TCP/IP Connectivity Utilities will add the Routing Entry for TELNETD at sequence number 2517. If you still want jobs that are submitted to the QSYSWRK subsystem with a compare value of QCMDI to run at a priority other than 50, then add that Routing Entry back at any available sequence number. - For tuning the System performance further, the run priority can be customized by replacing the QSYSCLS20 class with a different class, either system provided or user created, that references a different run priority. And with the new PTFs applied, that change will only affect the Telnet server jobs.
]]>鍒涘緩涓涓墿鐞嗘枃浠?鏈夋垨鑰呮病鏈塊ey瀛楁)http://www.tkk7.com/jjshcc/archive/2013/09/04/403664.htmlEric_jiangEric_jiangWed, 04 Sep 2013 08:59:00 GMThttp://www.tkk7.com/jjshcc/archive/2013/09/04/403664.htmlhttp://www.tkk7.com/jjshcc/comments/403664.htmlhttp://www.tkk7.com/jjshcc/archive/2013/09/04/403664.html#Feedback0http://www.tkk7.com/jjshcc/comments/commentRss/403664.htmlhttp://www.tkk7.com/jjshcc/services/trackbacks/403664.htmlCreate a Physical File with or without a key field 鍒涘緩涓涓墿鐞嗘枃浠?鏈夋垨鑰呮病鏈塊ey瀛楁)
The AS/400 database, DB2/400 is part of the AS/400 operating system. It is a relational database and has features similar to other databases you may have used such as Microsoft Access, Oracle or Dbase. The standard method of creating files is to define the specifications of the file using DDS. Of course DDS is used for other things on the AS/400 like defining display files and print files. AS/400鏁版嵁搴?DB2/400鏄疉S/400鎿嶄綔緋葷粺鐨勪竴閮ㄥ垎,瀹冩槸涓涓叧緋繪ф暟鎹簱.鍜屽叾浠栫殑鏁版嵁搴撶浉姣?渚嬪Microsoft Access, Oracle or Dbase鏈夌潃鐩鎬技鐨勭壒鎬?鐢―SS鏂囦歡緙栧啓璇存槑璇彞鏄垱寤烘暟鎹簱鏂囦歡鐨勬爣鍑嗘柟娉?褰撶劧,涔熷彲浠ヤ嬌鐢―SS鍦ˋS400鍋氬叾浠栦笢瑗?渚嬪鍒涘緩鏄劇ず鏂囦歡鎴栬呮墦鍗版枃浠?br /> To create a physical database file, enter your source statements in a DDS source file member. For example, name the member "CUS" for customer file. Make sure the member type is "PF". This tells the compiler that this is for a physical file. Notice that the first record has an "R" in position 17. This means that this line is specifying the record name, in this case "CUREC". The "TEXT" is optional but helps to document the file. 鍒涘緩涓涓墿鐞嗘枃浠舵暟鎹簱,浣犻渶瑕佸湪DSS鏂囦歡涓緭鍏ヤ綘鐨勬暟鎹弿榪頒唬鐮?渚嬪,浠ヤ竴涓狢ustomer鏂囦歡涓轟緥,鍛藉悕涓篊US鐨凪ember,瑕佺‘淇濊繖涓猰ember鐨勭被鍨嬫槸"PF",榪欐槸涓轟簡鍛婅瘔緙栬瘧鍣?榪欐槸涓涓墿鐞嗘枃浠?娉ㄦ剰鍒板湪絎竴琛屼腑,浣嶇疆17鐨勫湴鏂規湁涓?R"鐨勬爣璁?榪欎竴琛屾寚鏄庝簡璁板綍鐨勫悕瀛?榪欓噷璁板綍鍚嶅瓧灝辨槸CUREC.鑰孴ext涓嶆槸涓瀹氳,浣嗘槸涔熷鏂囨。鍖栨瘮杈冩湁鐢?
After the line naming the record, each line describes a field. The field name is followed by the field length and its data type.榪欎竴琛屽懡鍚嶄簡璁板綍涔嬪悗,涓嬮潰鐨勬瘡涓琛屾弿榪頒簡涓涓瓧孌?瀛楁鍚嶇О鍚庨潰鏄瓧孌電殑闀垮害鍜屾暟鎹被鍨?br /> The three most used data types are "A" for alpha or character, "S" for numeric and "P" for packed decimal. For numeric fields, you must also specify the number of decimal positions. So here, the company number field is a three digit number with no decimal places. The customer number and zip code are also numeric fields with no decimal places. The credit limit is a numeric, packed decimal field with 9 digits, of which two are after the decimal point. The rest of the fields are character fields. 鏈甯哥敤鐨勬暟鎹被鍨嬫槸涓嬮潰鐨勪笁縐? "A"浠h〃瀛楃,"S"浠h〃鏁板? "P"浠h〃packed decimal,瀵逛簬鏁板煎瓧孌?浣犲繀欏繪寚鏄庡皬鏁扮偣鐨勪綅緗?榪欓噷,鍏徃鍙風爜瀛楁灝辨槸涓涓?涓暟瀛楃殑鍙風爜,娌℃湁灝忔暟鐐?瀹㈡埛鍙風爜鍜岄偖鏀跨紪鐮佸悓鏍鋒槸鏁板瓧,涔熸槸娌℃湁灝忔暟,鑰屼俊鐢ㄩ搴︽槸涓涓暟鍊?瀹冧竴涓湁9涓暟瀛?鍏朵腑涓や綅鏁板間綅浜庡皬鏁扮偣鍚庨潰,鍏朵粬鐨勯兘鏄瓧絎︾殑瀹氫箟
Once you have entered the DDS source code, you must compile it. You do this by keying option 14 next to your member name on the PDM screen. If you pay attention you will see that the AS/400 is actually executing the CRTPF (Create Physical File) command. It knows to use this command because the member type of the source code is "PF". 涓鏃︿綘杈撳叆瀹孌DS浠g爜,浣犲繀欏葷紪璇戝畠,鍦≒DM鐣岄潰涓?鍦ㄤ綘瑕佺紪璇慚ember鍚嶅瓧鐨勫悗闈㈣緭鍏?4.鍋囧浣犵粏蹇冧竴鐐?浣犱細鍙戠幇AS400瀹為檯鎵ц浜咰RTPF (Create Physical File)鍛戒護,榪欐槸鍥犱負榪欎釜Member鐨勭被鍨嬫槸"PF"
You now have a database physical file, see Figure 1. This file has built into it the fields and their attributes. Let's modify this file definition to add key fields. If a physical file has key fields, programs can randomly access the records or read them sequentially in the order of the key fields.鐜板湪浣犲凡緇忔湁浜嗘暟鎹簱鐗╃悊鏂囦歡,濡傚浘1,榪欎釜鏂囦歡鍖呭惈浜嗗瓧孌靛拰浠栦滑鐨勫睘鎬?鐜板湪鎴戜滑灝變負鏂囦歡澧炲姞key瀛楁,鍋囧榪欎釜鐗╃悊鏂囦歡鍖呭惈浜唊ey瀛楁,閭d箞紼嬪簭灝卞彲浠ラ氳繃Key闅忓嵆鐨勮闂垨鑰呴『璁哥殑璁塊棶璁板綍
You can see in Figure 2 that it is simple to add key fields. 鐪嬪浘2,寤虹珛key瀛楁鏄潪甯哥畝鍗曠殑
The "UNIQUE" record at the beginning of the source is used if you want the AS/400 to insist on having no records with duplicate keys. This is optional. At the end of the source code, there are two lines with "K" in position 17. These lines define the key fields. So, this file will build a key using the company number and then the customer number. Further, it will not allow a duplicate company number / customer number record to be written. 寮澶寸殑閭d釜"UNIQUE"琛ㄦ槑浜嗕綘瑕丄S400涓嶈兘鍚湁閲嶅key鐨凴ecord,榪欐槸鍙夌殑. 浠g爜鐨勬湯灝炬渶鍚庝袱琛?鍦ㄤ綅緗?7鐨勬湁涓や釜"K",榪欎袱涓?K"灝辨槸瀹氫箟key瀛楁浜?閭d箞,榪欎釜鏂囦歡灝變細鐢ㄥ叕鍙稿彿鐮佸拰瀹㈡埛鍙風爜鏉ュ緩绔媖ey,榪涗竴姝ユ潵璇?鏂囦歡涓嶅厑璁稿惈鏈夊叕鍙稿彿鐮佸拰瀹㈡埛鍙風爜閮界浉鍚岀殑recored.
The records are written to the file in arrival sequence. If you read the data by specifying keyed access, the records will read as though they have been sorted by company number and customer number. Also, your programs can randomly retrieve records. For example, a "CHAIN" instruction in RPG can now randomly read the record for a specific company number / customer number. Record鏄寜欏哄簭鍐欏叆鏂囦歡鐨?鑰屽亣濡備綘璇誨彇鏁版嵁鐨勬椂鍊欐寚鏄巏ey,璇誨彇鐨勬暟鎹槸宸茬粡鎸夌収鍏徃鍙風爜鍜屽鎴峰彿鐮佹帓濂介『搴?鍚屾椂,浣犱篃鍙互闅忓嵆璇誨彇Record,渚嬪,RPG鐨?CHAIN"璇存槑絎﹀氨鍙互鐢ㄥ叕鍙稿彿鐮佸拰瀹㈡埛鍙風爜闅忓嵆璇誨彇鏂囦歡
Figure 1 - DDS for Physical File Without Key A R CUREC TEXT('CUSTOMER FILE') A CUCO 3S 0 TEXT('COMPANY #') A CUSTS 1A TEXT('STATUS CODE') A CUNUM 5S 0 TEXT('CUSTOMER #') A CUNAME 30A TEXT('CUSTOMER NAME') A CUADR 30A TEXT('CUSTOMER ADDRESS') A CUCITY 18A TEXT('CUSTOMER CITY') A CUSTAT 2A TEXT('CUSTOMER STATE') A CUZIP 9S 0 TEXT('CUSTOMER ZIP') A CUCRLM 9P 2 TEXT('CUST CREDIT LIMIT') Figure 2 - DDS for Physical File With Key Fields A UNIQUE A R CUREC TEXT('CUSTOMER FILE') A CUCO 3S 0 TEXT('COMPANY #') A CUSTS 1A TEXT('STATUS CODE') A CUNUM 5S 0 TEXT('CUSTOMER #') A CUNAME 30A TEXT('CUSTOMER NAME') A CUADR 30A TEXT('CUSTOMER ADDRESS') A CUCITY 18A TEXT('CUSTOMER CITY') A CUSTAT 2A TEXT('CUSTOMER STATE') A CUZIP 9S 0 TEXT('CUSTOMER ZIP') A CUCRLM 9P 2 TEXT('CUST CREDIT LIMIT') * A K CUCO A K CUNUM
A subfile is a display file where you can place a listing of values and process changes on the list. The list of members that you can see in the PDM is an example of a subfile.
In this chapter we'll create a subfile which will show all the cards from a client given its ID. To make the manipulation of several tables easier, we'll create a view with the fields we'll use on the subfile. In STRSQL insert this code:
When you press Enter a new record appears. Write SFLCTL on it:
鐜板湪鎴戜滑鎸変笅鍥炶濺錛屼竴涓柊鐨勮褰曞嚭鐜板涓嬶紝鍦ㄤ笂闈㈠啓涓婼FLCTL濡傚浘
This field creates a subfile control record, which works like the heading on the list.
榪欎釜瀛楁鐢ㄦ潵鍒涘緩瀛愭枃浠舵帶鍒惰褰曪紝灝卞儚鍒楄〃鐨勫ご閮?/div>
You have to activate some options now: 鐜板湪浣犻渶瑕佹縺媧諱笅闈㈢殑閫夐」
On the General Keywords menu insert the data you see below:
鍦℅eneral Keywords鑿滃崟杈撳叆杈撳叆濡備笅
These indicators allow us to manipulate the status of the subfile from the RPG code. Press Enter to go back to the previous screen. Select Subfile display layout.
On subfile maximum size type 9999 and on the number of records for page type 9:
鍦ㄥ瓙鏂囦歡鐨勬渶澶у艱緭鍏?999鍜岄〉闈㈢殑鏈澶ц褰曟暟杈撳叆9
Press enter to go back. Select the option Select Record Keyword:
杈撳叆鍥炶濺榪斿洖錛岀劧鍚庨夋嫨瀛楁鍏抽敭瀛楅夐」
Choose Overlay keywords: 閫夋嫨瑕嗙洊鍏抽敭瀛?/div>
Select Overlay without erasing: 閫夋嫨瑕嗙洊浣嗕笉鎿﹂櫎閫夐」
Press Enter until you're back on this screen: 杈撳叆鍥炶濺錛岀劧鍚庤繑鍥炲涓?nbsp;
Open the SFLCTL record. By default the record list is already visible on the design screen. Select to visualize the other 2 records, TOM and BOTTOM (F9).
We're going to add an indicator to this field, which will be activated when no record is found for an ID inserted (either the ID doesn't exist or it doesn't have any associated cards). Option Error Messages:
Notice how the field spread across the 9 line you previously defined as the subfile page size.
娉ㄦ剰浣犱箣鍓嶆槸濡備綍瀹氫箟瀛愭枃浠剁殑姣忛〉澶у皬涓?琛?/div>
Select the records from CLICARD view for output.
浠嶤LICARD瑙嗗浘涓夋嫨璁板綍浣滀負杈撳叆
The fields will probably be listed twice, because the SDA will show you the field that had been previously loaded from I/O in the SFLCTL record. You should select the fields further to the right, because they are the last ones loaded. You must be careful selecting the fields.
If there are more fields than the ones that can fit the message line, a plus (+) sign will appear at the end of the line. Press Page Down to see the remaining fields.
Place the fields on their positions: 灝嗗瓧孌墊斁鍦ㄧ浉鍏崇殑浣嶇疆
The final result: 鏈鍚庣殑緇撴灉
Don't forget to activate the indicator 03 at file-level so that “F3=Exit” can work and add the keyword INDARA to the code. Check out the Display file chapter if you don't remember how to do this.
Display files are DDS files that enable us to create AS/400 menus and screens to interact with the user. Display files can have several records. Each record defines part of the screen's appearance. These records may or may not overlap each other.
The SDA application allows us to “draw” what should show up on the screen and creates the DDS code from our “drawing”. Next we'll create a screen with DDS and afterward we'll look at some code excerpts, because sometimes it's easier to alter the screen through its code.
In this chapter 錛寃e'll create a screen to show a clients data.
鍦ㄨ繖涓绔狅紝鎴戜滑灝嗗垱寤轟竴涓樉紺哄鎴鋒暟鎹殑鐣岄潰銆?/div>
To open SDA type STRSDA on the system prompt. This screen should appear:
鍦ㄧ郴緇熷懡浠よ杈撳叆STRDA灝卞彲浠ユ墦寮SDA紼嬪簭浜嗭紝濡備笅鍥炬樉紺猴細
Choose option 1 and type the options as you see them on the image below. Source file is the file where the code will be stored. Member is the name of member we're creating.
When you type a string you should place it between apostrophes. If you don't each word will be handled like a different field. Placing the apostrophes allows you to manipulate all the words as a single field.
The *USER function shows the username on the screen. There are other functions that retrieve information from the system: *DATE (shows the system current date), *TIME(shows the system current time), *SYSNAME (shows the system name).
*USER鐢ㄦ潵鍦ㄥ睆騫曚笂鏄劇ず鐢ㄦ埛鍚?/div>
*DATE鐢ㄦ潵鍦ㄥ睆騫曚笂鏄劇ず緋葷粺褰撳墠鏃ユ湡銆?/div>
*TIME 鐢ㄦ潵鍦ㄥ睆騫曚笂鏄劇ず緋葷粺鐨勫綋鍓嶆椂闂淬?/div>
*SYSNAME 鐢ㄦ潵鍦ㄥ睆騫曚笂鏄劇ず緋葷粺鍚嶇О銆?/div>
After typing what you see on the image press Enter. Always check what you've done before pressing Enter, because after that you can only alter the screen by manipulating its code. You can also exit the record editing without saving your work, but then you'll lose all you've done since you last opened the record for editing.
You can move a field to the right placing “>” characters to the right of the field. The number of > you type will be the number of columns the field will move. To move the field to the left place < signs on the left side of the field.
To center a field on the screen place an 'ac' at the left of the field and the 'c' must be overlapping the first character of the field. Then press Enter.
Press F3 to finish editing this record. Choose option 1 to save your work:
When you open the new record for editing press F9. This menu will appear:
褰撲綘鎵撳紑鎸変笅F9瀵規柊鐨勮褰曪紝鎴戜滑鍙互鐪嬭鑿滃崟鏄劇ず鍑烘潵浜?/div>
So that you don't overlap the records you can choose to visualize other records in the menu. You can see that the status of the BOTTOM record is “In Use” which means it is the one currently being edited. You can select at most 3 records to visualize. To do so place numbers 1 to 3 on the records you want. Select the TOP record and press Enter.
The names of the selected fields appear on the bottom of the screen. Don't forget you are only “drawing” on the record in use. The other records only help you place your elements on the right place.
Create a new record, MIDDLE, the same way you've created the previous records.
鍒涘緩涓涓柊鐨勮褰曪紝MIDDLE錛屾柟娉曡窡浣犱箣鍓嶇殑浜嬩竴鏍風殑
Press F9 to visualize the records you already created:
鎸塅9鍙鍖栦綘鍒氬垰鍒涘緩鐨勮褰?/div>
Draw what you can see in the following image. Press Enter when you're done.
鎸夌収涓嬪浘鑽夌粯鐣岄潰錛屽畬鎴愬悗鎸夊洖杞?/div>
Add fields
娣誨姞瀛楁
Using table records
浣跨敤琛ㄨ褰?/div>
We're going to select the fields from the Clients table to show them on the screen. Press F10. On that menu select the Database File Clients for output (option 3). You can also select fields for input or input/output choosing one of the other options. You should write this on the menu and press Enter:
鐜板湪鎴戜滑灝嗚鍦ㄥ鎴瘋〃涓夋嫨鎴戜滑鎯寵鐨勫瓧孌碉紝灝嗕粬浠樉紺哄湪鐣岄潰涓婇潰錛屾寜涓婩10錛岀幇鍦ㄧ3欏癸紙select the Database File Clients for output錛夛紝浣犱篃鍙互涓哄叾瀹冪殑閫夐」錛岄夋嫨瀛楁浣滀負杈撳嚭鍜岃緭鍏ャ?/div>
Select the table 閫夋嫨琛?/span>
On the bottom of the screen there's a message with all the Client's field names preceded by a number. To use a field on the screen you should write its correspondent number preceded with an '&'. You can see it in the next image. Be careful, because if you write a number and press Enter the order of the list on the bottom will change.
Exit the record editing. We now need to make a few adjustments to the file options.
鎺ㄥ嚭璁板綍緙栬緫錛屾垜浠渶瑕佸鏂囦歡閫夐」榪涜涓浜涗慨鏀?/div>
Record level options (overlay) 璁板綍灞傞潰閫夐」錛堣鐩栵級
Choose option 8 to the TOP record: 鍦═op璁板綍閫夋嫨閫夐」8
Change overlay option 淇敼瑕嗙洊閫夐」
Select option Overlay Keywords: 閫夋嫨瑕嗙洊鍏抽敭瀛?/div>
Change overlay option step 2 淇敼瑕嗙洊閫夐」絎簩姝?/span>
Place an Y at the option Overlay without erasing. This option allows to display this record on the screen together with the others. Press Enter until you reach the menu with the record listing. Activate this option on the other records.
鍦ㄩ夐」錛圤verlay without erasing錛夌殑鍦版柟杈撳叆Y錛岃繖涓夐」鍏佽浣犲湪灞忓箷鐣岄潰涓悓鏃舵樉紺哄叾浠栫殑璁板綍銆備竴璺洖杞︾洿鑷充綘鐪嬪埌璁板綍鍒楄〃錛屽湪鍏朵粬鐣岄潰涓縺媧昏繖涓夐」
We need to declare the indicator 03 (so that “F3=Exit” works) at the file level. On the menu with the record listing press F14 (F13=shift+F1; F14=shift+F2; F15=shift+F3, etc.). On the following screen choose the option Indicator Keywords.
These are the file-level options. You should add a line to this area that later will allow you to rename the indicators used. Add this line after the DSPSIZ line:
You should also have some lines like these: 浣犱篃鍙互娣誨姞鍑犺鍍忎笅闈㈢殑錛?/div>
A R TOP
A OVERLAY
A 1 65USER
A 3 27'Client Details:'
In these four lines are the definitions to the TOP record. Notice the OVERLAY option we had defined in SDA. The keyword USER is placed on the 1st line, column 65.
Look at this line from MIDDLE record: 鐜板湪鎴戜滑鐪嬬湅MIDDLE鐨勮褰?/div>
A ID_CLI R O 8 23REFFLD(CLIENTS/ID_CLI DEMO/CLIENTS)
Here you have a reference to the ID_CLI field on the CLIENTS table and this reference is positioned at line 8 column 23, an can only be accessed for reading (O).
Compile the file (option 14) after you've closed the member.
鍏抽棴浜嗚繖涓垚鍛樹箣鍚庯紝浣犲彲浠ユ寜F14緙栬瘧榪欎釜鏂囦歡銆?/div>
Executing display files 鎵ц鏄劇ず鏂囦歡
To run the screen you must create an RPGLE member which will handle all the possible events (pressing F3 for example). Check out the file QRPGLESRC.SHW_CLI to see how this member should be defined. Create a file like QRPGLESRC.SHW_CLI and run it. The result should be something like this: