亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 4724 | 回復: 8
打印 上一主題 下一主題

問個問題--能不能在PF中定義一個有默認值的字段 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2008-09-10 21:34 |只看該作者 |倒序瀏覽
5可用積分
最近在做項目時發(fā)現(xiàn)以下幾個問題:
1.希望在PF中定義有默認值的字段,比如一個字段,程序WRITE或INERT時,如果沒有對該字段賦值,則系統(tǒng)自動使用定義的默認值,該默認值要是程序員自己定義的,不能是"" 或者是0這種。比如,如果用戶沒有輸入金錢的幣種,則系統(tǒng)自動默認為"RMB".

2.希望在PF中定義時間戳類型的字段,因為沒有在DDS中查到時間戳類型,不知道如何實現(xiàn)。
比如:一條記錄WRITE進入PF中,則無需對該字段賦值,該字段自動寫上記錄WRITE時的日期和時間。類型DB2中的時間戳類型。

謝謝!

論壇徽章:
0
2 [報告]
發(fā)表于 2008-09-10 21:52 |只看該作者
http://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topic=/com.ibm.etools.iseries.langref2.doc/rzakbmsttpdft.htm

DDS for physical and logical filesDFT (Default) keyword--physical files onlyUse this field-level keyword to specify a default value for a field. The format of the keyword is: DFT('value' | numeric-value | X'hexadecimal-value' | *NULL)Without this keyword, character and hexadecimal fields default to blanks and numeric fields default to zeros. However, if you specify the ALWNULL keyword for the field, then the character, hexadecimal, and numeric fields default to the null value. The following rules apply to the specified value:
  • If the field being defined is a character field, specify a character constant, hexadecimal value, or *NULL. Specify character strings within apostrophes. If the field is variable length (VARLEN), then the length of the string must be less than or equal to the allocated length. Specify hexadecimal values as an X followed by a combination of the digits 0 through 9 and the letters A through F. Enclose the combination in apostrophes. The number of hexadecimal digits in apostrophes must be exactly twice the specified length of the field. If the field is variable length (VARLEN), then the number of hexadecimal digits in apostrophes must be exactly twice the allocated length.
  • If the field being defined is a hexadecimal field, specify a character constant, hexadecimal value, or *NULL. Note: If a character constant is specified, the hexadecimal representation of the character constant is the default value. Specify character strings within apostrophes. If the field is variable length (VARLEN), then the length of the string must be less than or equal to the allocated length. Specify hexadecimal values as an X followed by a combination of the digits 0 through 9 and the letters A through F. Enclose the combination in apostrophes. The number of hexadecimal digits in apostrophes must be exactly twice the specified length of the field. If the field is variable length (VARLEN), then the number of hexadecimal digits in apostrophes must be exactly twice the allocated length.
  • If you are defining a numeric field, specify a numeric value (digits 0 through 9 specified without apostrophes) or *NULL. For a value other than zero in positions 36 and 37, specify the decimal character with a numeric constant in the appropriate position in the DDS.
  • If you specify *NULL, then you must also specify the ALWNULL keyword on the field.
  • If you do not specify any value (DFT('')), this indicates a default of a 0 length string and is valid only when the field is variable length (the VARLEN keyword must also be specified).
  • If you are defining a date field, specify a valid date in the same format specified on the DATFMT keyword and use the same separator as specified on the DATSEP keyword. For example, DFT('12/15/91') is the default value if *MDY is specified for DATFMT and '/' is specified for DATSEP. If the DFT keyword is not specified, the default value is the current date.
  • If you are defining a time field, specify a valid time in the same format specified on the TIMFMT keyword and use the same separator as specified on the TIMSEP keyword. For example, DFT('11.00.00') is the default value if *ISO is specified for TIMFMT. The default separator for *ISO is a period (.). If the DFT keyword is not specified, the default value is the current time.
  • If you are defining a timestamp field, you must specify the default value in the following format: DFT('YYYY-MM-DD-HH.MM.SS.UUUUUU')If the DFT keyword is not specified, the default value is the current time.
The value specified is assigned to the field in the following cases:
  • When the program does an output operation to a logical file based on this physical file and the record format in the logical file does not name this field.
  • When you use the Initialize Physical File Member (INZPFM) command for a member in this file.
  • When you use the Copy File (CPYF) command with FMTOPT(*MAP) specified and a field in the to-file is not in the from-file.
The specified value is supplied to the program when the program does an input operation to a join logical file and all of the following are true:
  • You specify the JDFTVAL keyword for the join logical file.
  • The file being defined is specified as a secondary file in the join logical file.
  • When the input operation occurs and the link to the secondary file produces no records.
This keyword does not affect the physical file on input operations. Example: The following example shows how to specify the DFT keyword. |...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....800010A          R RECORD100020A            CHARFLD1      20A         DFT('Sample field')00030A            CHARFLD2       5A         DFT(X'D985955185')00040A            HEXFLD1        3H         DFT('ABC')00050A            HEXFLD2        3H         DFT(X'C1C2C3')00060A            NUMFLD1        5S 0       DFT(99999)00070A            NUMFLD2        5S 2       DFT(999.99)00080A            NUMFLD3        5S 2       DFT(999)00090A            NUMFLD4        5S 2       DFT(*NULL)00100A                                      ALWNULL00110A            NUMFLD5        5S 2       DFT(999.99)00120A                                      ALWNULL00130A            DATFLD1         L         DATFMT(*MDY) DATSEP('-')00140A                                      DFT('12-31-91')00150A            TIMFLD1         T         DFT('11.15.00')     AThe default value for CHARFLD1 is 'Sample field'. The default value for CHARFLD2 is hex D985955185. The default value for HEXFLD1 is C1C2C3 (the hexadecimal representation of the character constant). The default value for HEXFLD2 is C1C2C3. The default value for NUMFLD1 is 99999 (no decimal character is required because the field has zero decimal positions). The default value for NUMFLD2 is 999.99. The default value for NUMFLD3 is 999 (no decimal character is required if you do not need to specify decimal values). The default value for NUMFLD4 is the null value (ALWNULL is a required keyword for the field if DFT(*NULL) is specified). The default value for NUMFLD5 is 999.99; the field also allows the null value. The default value for DATFLD1 is 12-31-91. The default value for TIMFLD1 is 11.15.00 (*ISO format). [ Top of Page | Previous Page | Next Page | Table of Contents | Index ] (C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.

論壇徽章:
0
3 [報告]
發(fā)表于 2008-09-10 21:56 |只看該作者
唉,BBS 還是有 BUG 啊,^C、^V 就不能一致。
還是看 IBM 的原文連接吧。

時間戳類型 是 Z, 可用 TIME 賦值。

論壇徽章:
0
4 [報告]
發(fā)表于 2008-09-10 22:14 |只看該作者
試試clear recordformat

論壇徽章:
0
5 [報告]
發(fā)表于 2008-09-11 12:31 |只看該作者
如果用到rpg程序操作,太簡單了。

1)likeDS

2)inz

論壇徽章:
0
6 [報告]
發(fā)表于 2008-09-29 23:51 |只看該作者
想問一下,上面介紹的方法是RPGLE的吧,對于RPG3有沒有效果?

論壇徽章:
0
7 [報告]
發(fā)表于 2008-10-05 16:14 |只看該作者
這個應該是可以的,通過DDS的鍵字,RPG3中沒有查過reference,但是在v5r3中是可以的,另外通過SQL語句
Alter table alter column  set  語句或者通過create table 中的default 可以實現(xiàn)該功能沒問題的。

論壇徽章:
0
8 [報告]
發(fā)表于 2008-10-20 21:04 |只看該作者

還是未能解決

還是未能解決

論壇徽章:
0
9 [報告]
發(fā)表于 2008-10-21 15:40 |只看該作者
DFT(缺省值)——僅用于物理文件
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP