COBOL Question
本帖最后由 rolexliu 于 2011-03-16 10:27 编辑
SEU==> ACCTMST
FMT PF .....A..........T.Name++++++RLen++TDpB......Functions+++++++++++++++++++++++++++ ...+... 9 ...+... 0
*************** Beginning of data ***************************************************************************************
0001.00 A R ACCNTREC 110315
0002.00 A ACCNTKEY 5 0 110315
0003.00 A NAME 20 110315
0004.00 A ADDR 20 110315
0005.00 A CITY 20 110315
0006.00 A STATE 2 110315
0007.00 A ZIP 5 110315
0008.00 A BALANCE 10 2 110315
0009.00 A K ACCNTKEY 110315
SEU==> ACCTFMTS
FMT DP .....AAN01N02N03T.Name++++++RLen++TDpBLinPosFunctions+++++++++++++++++++++++++++ ...+... 9 ...+... 0
*************** Beginning of data ***************************************************************************************
0001.00 A INDARA 110315
0002.00 A*************************************************************** 110315
0003.00 A R ACCTPMT TEXT('CUSTOMER ACCOUNT PROMPT') 110315
0004.00 A CA01(15 'END OF PROGRAM') 110315
0005.00 A PUTRETAIN OVERLAY 110315
0006.00 A 1 3'ACCOUNT MASTER UPDATE' 110315
0007.00 A 3 3'FROM ACCOUNT NUMBER' 110315
0008.00 A ACCTFROM 5Y 0I 3 23CHECK(ME) 110315
0009.00 A 99 ERRMSG('INVALID FROM ACCOUNT + 110315
0010.00 A NUMBER' 99) 110315
0011.00 A 98 ERRMSG('INSUFFICIENT FUNDS IN FROM + 110315
0012.00 A ACCOUNT' 9 110315
0013.00 A 4 3'TO ACCOUNT NUMBER' 110315
0014.00 A ACCTTO 5Y 0I 4 23CHECK(ME) 110315
0015.00 A 97 ERRMSG('INVALID TO ACCOUNT + 110315
0016.00 A NUMBER' 97) 110315
0017.00 A 5 3'AMOUNT TRANSFERRED' 110315
0018.00 A TRANSAMT 10Y 2I 5 23 110315
0019.00 A 110315
0020.00 A R ERRFMT 110315
0021.00 A 96 6 5'INVALID FILE STATUS' 110315
0022.00 A 95 7 5'INVALID KEY IN REWRITE' 110315
0023.00 A 110315
SEU==> ACCOUNT
FMT CB ......-A+++B++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Pgm-id++ ...+... 9 ...+... 0
*************** Beginning of data ***************************************************************************************
0001.00 IDENTIFICATION DIVISION. 000000
0002.00 PROGRAM-ID. ACCOUNT. 110315
0003.00 AUTHOR. PROGRAMMER NAME. 110315
0004.00 INSTALLATION. COBOL DEVELOPMENT CENTRE. 110315
0005.00 DATE-WRITTEN. 02/02/88. 110315
0006.00 DATE-COMPILED. 02/02/88. 110315
0007.00 ENVIRONMENT DIVISION. 110315
0008.00 CONFIGURATION SECTION. 110315
0009.00 SOURCE-COMPUTER. IBM-AS400. 110315
0010.00 OBJECT-COMPUTER. IBM-AS400. 110315
0011.00 INPUT-OUTPUT SECTION. 110315
0012.00 FILE-CONTROL. 110315
0013.00 SELECT ACCOUNT-FILE ASSIGN TO DATABASE-ACCTMST 110315
0014.00 ORGANIZATION IS INDEXED 110315
0015.00 ACCESS IS DYNAMIC 110315
0016.00 RECORD IS EXTERNALLY-DESCRIBED-KEY 110315
0017.00 FILE STATUS IS ACCOUNT-FILE-STATUS. 110315
0018.00 SELECT DISPLAY-FILE ASSIGN TO WORKSTATION-ACCTFMTS-SI 110315
0019.00 ORGANIZATION IS TRANSACTION. 110315
0020.00 I-O-CONTROL. 110315
0021.00 COMMITMENT CONTROL FOR ACCOUNT-FILE. 110315
0022.00 DATA DIVISION. 000000
0023.00 FILE SECTION. 110315
0024.00 FD ACCOUNT-FILE 110315
0025.00 LABEL RECORDS ARE STANDARD. 110315
0026.00 01 ACCOUNT-RECORD. 110315
0027.00 COPY DDS-ALL-FORMATS OF ACCTMST. 110315
0028.00 FD DISPLAY-FILE 110315
0029.00 LABEL RECORDS ARE STANDARD. 110315
0030.00 01 DISPLAY-REC. 110315
0031.00 COPY DDS-ALL-FORMATS OF ACCTFMTS. 110315
0032.00 WORKING-STORAGE SECTION. 110222
0033.00 77 ACCOUNT-FILE-STATUS PIC X(2). 110315
0034.00 77 IND-ON PIC 1 VALUE B"1". 110315
0035.00 77 IND-OFF PIC 1 VALUE B"0". 110315
0036.00 01 DISPFILE-INDICS. 110315
0037.00 COPY DDS-ALL-FORMATS-INDIC OF ACCTFMTS. 110315
0038.00 110315
0039.00 PROCEDURE DIVISION. 000000
0040.00 *DECLARATIVES. 110315
0041.00 *ERROR-SECTION SECTION. 110315
0042.00 * USE AFTER STANDARD EXCEPTION PROCEDURE ON ACCOUNT-FILE. 110315
0043.00 *ERROR-PARAGRAPH. 110315
0044.00 * IF ACCOUNT-FILE-STATUS IS NOT EQUAL "23" THEN 110315
0045.00 * MOVE IND-ON TO IN96 OF ERRFMT-O-INDIC 110315
0046.00 * ELSE 110315
0047.00 * MOVE IND-ON TO IN95 OF ERRFMT-O-INDIC. 110315
0048.00 * WRITE DISPLAY-REC FORMAT IS "ERRFMT" 110315
0049.00 * INDICATORS ARE ERRFMT-O-INDIC. 110315
0050.00 * READ DISPLAY-FILE. 110315
0051.00 * CLOSE DISPLAY-FILE. 110315
0052.00 * ACCOUNT-FILE. 110315
0053.00 * STOP RUN. 110315
0054.00 *END DECLARATIVES. 110315
0055.00 MAIN-PROGRAM SECTION. 110315
0056.00 MAINLINE. 110315
0057.00 OPEN I-O DISPLAY-FILE 110315
0058.00 I-O ACCOUNT-FILE 110315
0059.00 MOVE ZEROS TO ACCTPMT-I-INDIC 110315
0060.00 ACCTPMT-O-INDIC. 110315
0061.00 PERFORM WRITE-READ-DISPLAY. 110315
0062.00 PERFORM VERIFY-ACCOUNT-NO UNTIL IN15 EQUAL IND-ON. 110315
0063.00 CLOSE DISPLAY-FILE 110315
0064.00 ACCOUNT-FILE. 110315
0065.00 STOP RUN. 110315
0066.00 110315
0067.00 VERIFY-ACCOUNT-NO. 110315
0068.00 PERFORM VERIFY-TO-ACCOUNT. 110315
0069.00 IF IN97 OF ACCTPMT-O-INDIC EQUAL IND-OFF THEN 110315
0070.00 PERFORM VERIFY-FROM-ACCOUNT. 110315
0071.00 PERFORM WRITE-READ-DISPLAY. 110315
0072.00 110315
0073.00 VERIFY-FROM-ACCOUNT. 110315
0074.00 MOVE ACCTFROM TO ACCNTKEY 110315
0075.00 READ ACCOUNT-FILE 110315
0076.00 INVALID KEY MOVE IND-ON TO IN99 OF ACCTPMT-O-INDIC. 110315
0077.00 IF IN99 OF ACCTPMT-O-INDIC EQUAL IND-ON THEN 110315
0078.00 ROLLBACK 110315
0079.00 ELSE 110315
0080.00 PERFORM UPDATE-FROM-ACCOUNT. 110315
0081.00 110315
0082.00 VERIFY-TO-ACCOUNT. 110315
0083.00 MOVE ACCTTO TO ACCNTKEY. 110315
0084.00 READ ACCOUNT-FILE 110315
0085.00 INVALID KEY MOVE IND-ON TO IN97 OF ACCTPMT-O-INDIC. 110315
0086.00 IF IN97 OF ACCTPMT-O-INDIC EQUAL IND-ON THEN 110315
0087.00 ROLLBACK 110315
0088.00 ELSE 110315
0089.00 PERFORM UPDATE-TO-ACCOUNT. 110315
0090.00 110315
0091.00 UPDATE-TO-ACCOUNT. 110315
0092.00 ADD TRANSAMT TO BALANCE. 110315
0093.00 REWRITE ACCOUNT-RECORD. 110315
0094.00 110315
0095.00 UPDATE-FROM-ACCOUNT. 110315
0096.00 SUBTRACT TRANSAMT FROM BALANCE. 110315
0097.00 REWRITE ACCOUNT-RECORD. 110315
0098.00 IF BALANCE IS LESS THAN 0 THEN 110315
0099.00 MOVE IND-ON TO IN98 OF ACCTPMT-O-INDIC 110315
0100.00 ROLLBACK 110315
0101.00 ELSE 110315
0102.00 COMMIT. 110315
0103.00 110315
0104.00 WRITE-READ-DISPLAY. 110315
0105.00 WRITE DISPLAY-REC FORMAT IS "ACCTPMT" 110315
0106.00 INDICATORS ARE ACCTPMT-O-INDIC. 110315
0107.00 MOVE ZEROS TO ACCTPMT-I-INDIC 110315
0108.00 ACCTPMT-O-INDIC. 110315
0109.00 READ DISPLAY-FILE RECORD 110315
0110.00 INDICATORS ARE ACCTPMT-I-INDIC. 110315
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
去掉COMMITMENT CONTROL, 程序正常执行...难道COBOL的事物处理跟RPG不一样?
File Status Code Meaning
21 Rewrite or Delete failed – possibly because the record did not exist
22 Write failed – either the file was locked or the database’s unique key condition would be corrupted
23 Random access failed – record was not found
24 Write failed – file too small
35 File not opened
37 Open was attempted but not possible – maybe and I-O phrase was used for a file where read only authorities exist
38 Open statement attempted after the file had been previously opened
39 Open statement failed because the record layout does not match what the program expected.
41 And open statement attempted for a file that was already opened
42 Close statement attempted for a file that was already closed
43 Occurs on a rewrite command where the previous read was unsuccessful
44 Record layout of the file does not match what the program was expecting – get this on write or rewrite
46 Happens on a sequential read or a start statement when the record does not exist
47 Read or Start on a file that was output only
48 Write statement on a file that was opened as input only
49 Delete or rewrite attempted on an input only file
90 File not found
91 Can’t access the file
92 File is locked
94 REWRITE or DELETE failed because no prior read
95 Duplicate key problem in select statement
9C
9D Record is locked
9G Can’t output to device
9H Locking issue
9I Write failed
9K Invalid format name
9N Hardware error
9P Open failed because commitment control expected
9Q File size problem
9R Referential integrity error – duplicate key error
9S Failed read before REWRITE or DELETE
9T Trigger program exception
9U Can’t read prior – close the file and then open it again
9W Check constraint Exception – look at database
9X Open failed because file type is not supported
9Y Open failed because of auxiliary storage pool problem – did a disk crash?
好奇怪, file status是9P, 有人知道9P代表什么意思? File已经journel过,Call program 之前已启动事物处理.
Display Module Source
Program: ACCOUNT Library: QTEMP Module: ACCOUNT
33 77 ACCOUNT-FILE-STATUS PIC X(2).
34 77 IND-ON PIC 1 VALUE B"1".
35 77 IND-OFF PIC 1 VALUE B"0".
36 01 DISPFILE-INDICS.
37 COPY DDS-ALL-FORMATS-INDIC OF ACCTFMTS.
38
39 PROCEDURE DIVISION.
40 *DECLARATIVES.
41 *ERROR-SECTION SECTION.
42 * USE AFTER STANDARD EXCEPTION PROCEDURE ON ACCOUNT-FILE.
43 *ERROR-PARAGRAPH.
44 * IF ACCOUNT-FILE-STATUS IS NOT EQUAL "23" THEN
45 * MOVE IND-ON TO IN96 OF ERRFMT-O-INDIC
46 * ELSE
47 * MOVE IND-ON TO IN95 OF ERRFMT-O-INDIC.
More...
Debug . . .
F3=End program F6=Add/Clear breakpoint F10=Step F11=Display variable
F12=Resume F17=Watch variable F18=Work with watch F24=More keys
ACCOUNT-FILE-STATUS = '9P'
回复 4# lizi211314
回复 3# lizi211314
ACCTTO 是从屏幕输入的值, 我debug过, 貌似此值无问题.
_______________________________________________________
ACCOUNT MASTER UPDATE
FROM ACCOUNT NUMBER 11111
TO ACCOUNT NUMBER 22222
AMOUNT TRANSFERRED 88888888.88
_______________________________________________________
Display Module Source
Program: ACCOUNT Library: QTEMP Module: ACCOUNT
79 ELSE
80 PERFORM UPDATE-FROM-ACCOUNT.
81
82 VERIFY-TO-ACCOUNT.
83 MOVE ACCTTO TO ACCNTKEY.
84 READ ACCOUNT-FILE
85 INVALID KEY MOVE IND-ON TO IN97 OF ACCTPMT-O-INDIC.
86 IF IN97 OF ACCTPMT-O-INDIC EQUAL IND-ON THEN
87 ROLLBACK
88 ELSE
89 PERFORM UPDATE-TO-ACCOUNT.
90
91 UPDATE-TO-ACCOUNT.
92 ADD TRANSAMT TO BALANCE.
93 REWRITE ACCOUNT-RECORD.
More...
Debug . . .
F3=End program F6=Add/Clear breakpoint F10=Step F11=Display variable
F12=Resume F17=Watch variable F18=Work with watch F24=More keys
ACCTTO = 22222.
无意中发现 今天是我注册CU两周年的日子。。。。。
DEBUG一下,看看走到这一步的时候ACCTTO 是什么值,你在dspf里面这个值输入了么?
4 > STRCMTCTL LCKLVL(*CHG)
4 > call account
Specified record length is not equal to record length of file.
Commitment definition *N not valid for open of ACCTMST.
Pointer not set for location referenced.
Function check. MCH3601 unmonitored by ACCOUNT at statement 0000000079,
instruction X'0000'.
Message 'MCH3601' in program object 'ACCOUNT' in library 'QTEMP' (C D F
G).
More...
程序在执行"MOVE ACCTTO TO ACCNTKEY."时报错, 请COBOL大侠们帮忙看看, 问题在哪 ? Thanks.