Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error message not displayed on line 24th in display file.

78 views
Skip to first unread message

Narendra kumar

unread,
Sep 3, 2022, 3:54:57 AM9/3/22
to
Hi I am new to Cobol/400 and writing one program where the user will enter the Customer No. IF customer number is not present in DB then error message should be displayed " Customer invalid" for this i have defined the Indicator 21 in the DSPF. On providing the wrong customer number error message is not displayed. On providing the correct customer number details are displayed. Please help me out how to display the error message. Below is the DSPF DDS and Cobol program.

[Code]
0000.30 A DSPSIZ(24 80 *DS3)
0000.40 A REF(NARENKUM1/CUSMSTP)
0000.50 A PRINT
0000.60 A INDARA
0000.70 A CA03(03 'PRESS F3 TO EXIT.')
0000.80 A R CUSPMT
0000.90 A*%%TS SD 20220901 180822 NARENKUM REL-V7R5M0 5770-WDS
0001.00 A 1 3'CUSTOMER MASTER INQUIRY'
0001.10 A 3 3'CUSTOMER NUMBER'
0001.20 A 5 3'USE F3 TO END PROGRAM, USE ENTER T-
0001.30 A O RETURN TO PROMPT SCREEN'
0001.40 A CUST R I 3 20REFFLD(CUSMST/CUST NARENKUM1/CUSMST-
0001.50 A P)
0001.60 A 21 ERRMSG('CUSTOMER NOT FOUND' 21)
0001.70 A R CUSFLDS
0001.80 A*%%TS SD 20220902 022438 NARENKUM REL-V7R5M0 5770-WDS
0001.90 A OVERLAY
0002.00 A 8 3'NAME'
0002.10 A 9 3'ADDRESS'
0002.20 A 10 3'CITY'
0002.30 A 11 3'STATE'
0002.40 A 7 3'CUST'
0002.50 A CUST R O 7 14REFFLD(CUSMST/CUST NARENKUM1/CUSMST-
0002.60 A P)
0002.70 A NAME R O 8 14REFFLD(CUSMST/NAME NARENKUM1/CUSMST-
0002.80 A P)
0002.90 A ADDR R O 9 14REFFLD(CUSMST/ADDR NARENKUM1/CUSMST-
0003.00 A P)
0003.10 A CITY R O 10 14REFFLD(CUSMST/CITY NARENKUM1/CUSMST-
0003.20 A P)
0003.30 A STATE R O 11 14REFFLD(CUSMST/STATE NARENKUM1/CUSMS-
0003.40 A TP)
****************** End of data ************************************************** **​
[/Code]

Below is the Cobol/400 program

[code]
0001.00 identification division.
0002.00 program-id. Cusminqy.
0003.00 environment division.
0004.00 input-output section.
0005.00 file-control.
0006.00 select customer-file
0007.00 assign to database-cusmstp
0008.00 organization is indexed
0009.00 access mode is random
0010.00 record key is externally-described-key
0011.00 file status is ws-cus-file-status.
0012.00
0013.00 select customer-screen-file
0014.00 assign to workstation-cusminq-si
0015.00 organization is transaction
0015.01 access is sequential
0016.00 file status is ws-cus-screen-file-status
0017.00 control-area is ws-screen-control-area.
0018.00
0019.00 data division.
0020.00 file section.
0021.00 fd customer-file
0022.00 label records are standard.
0023.00 01 customer-record.
0024.00 copy dd-all-formats of cusmstp.
0025.00
0026.00 fd customer-screen-file
0027.00 label records are omitted.
0028.00 01 display-record.
0029.00 copy dds-all-formats of cusminq.
0030.00​
0030.00
0031.00 working-storage section.
0032.00 01 ws-file-status.
0033.00 05 ws-cus-file-status pic x(2) value '00'.
0034.00 05 ws-cus-screen-file-status pic x(2) value '00'.
0034.01
0035.00 01 ws-screen-control-area.
0036.00 05 ws-key-pressed pic x(2).
0039.00 88 function-key03 value "03".
0039.04
0040.00 01 ws-screen-indicators.
0041.00 05 ws-scr-indicator pic 1 occurs 99 times indicator 1.
0042.00 88 indicator-off value b"0".
0043.00 88 indicator-on value b"1".
0043.01
0044.00 01 ws-indicators-used.
0045.00 05 invalid-cusno pic 9(2) value 21.
0045.01
0047.00 01 ws10-abend-variables.
0048.00 05 ws10-program-name pic x(9) value 'cusminqy'.
0049.00 05 ws10-file-status pic x(2) value spaces.
0050.00 05 ws10-error-message pic x(80) value spaces.
0050.01
0050.02 01 work-fields.
0050.03 05 ws-check pic x(1) value 'n'.
0050.05
0051.00 procedure division.
0052.00 0000-start.
0053.00 perform 1000-initialisation.
0054.00 perform 2000-main-processing
0055.00 until function-key03.
0056.00 perform 3000-termination-process.
0057.00 0000-exit.
0058.00 stop run.
0059.00 *-------------------------------------*
0060.00 1000-initialisation.
0061.00 perform 1100-open-file.
0062.00 initialize ws-screen-indicators.
0063.00 initialize ws-key-pressed.
0064.00 initialize cuspmt-i.
0065.00 perform 1200-display-header.
0066.00 *-------------------------------------------------------------*
0067.00 * this section will be used to open the files *
0068.00 * used in this program. *
0069.00 *-------------------------------------------------------------*
0070.00 1100-open-file.
0071.00 open input customer-file.
0072.00 evaluate ws-cus-file-status
0073.00 when '00'
0074.00 continue
0075.00 when other
0076.00 move ws-cus-file-status to ws10-file-status
0077.00 move 'error in opening cus file' to ws10-error-message
0078.00 perform z200-file-abend-process
0079.00 end-evaluate.
0080.00
0081.00 open i-o customer-screen-file.
0082.00 evaluate ws-cus-screen-file-status
0083.00 when '00'
0084.00 continue
0085.00 when other
0086.00 move ws-cus-screen-file-status to ws10-file-status
0087.00 move 'error in opening cus screen file'
0088.00 to ws10-error-message
0089.00 perform z200-file-abend-process
0090.00 end-evaluate.
0091.00 *--------------------------------------------------------*
0092.00 * this section will display the employee add screen *
0093.00 *--------------------------------------------------------*
0094.00 1200-display-header.
0095.00 write display-record
0096.00 format is "cuspmt"
0097.00 indicators are ws-screen-indicators.
0098.00 read customer-screen-file
0098.01 format is "cuspmt"
0099.00 indicators are ws-screen-indicators.
0100.00 *--------------------------------------------------------*
0101.00 * display the emp screen unti f03 key is pressed *
0102.00 *--------------------------------------------------------*
0103.00 2000-main-processing.
0103.01 move cust of cuspmt-i to cust of cusmst.
0103.02 read customer-file
0103.03 invalid key
0103.04 set indicator-on(invalid-cusno) to true
0103.05 perform 2200-display-header
0103.13 not invalid key
0103.14 move 'y' to ws-check
0103.15 perform 2100-write-screen-record
0103.21 end-read.
0120.00 ************************************************** *********
0121.00 *---------------------------------------------------------*
0122.00 * this will check the emp no is blank and also *
0123.00 * if the record already present in data base *
0124.00 *---------------------------------------------------------*
0124.01 2100-write-screen-record.
0124.03 move name of cusmst to name of cusflds-o.
0124.04 move city of cusmst to city of cusflds-o.
0124.05 move state of cusmst to state of cusflds-o.
0124.06 move addr of cusmst to addr of cusflds-o.
0124.07 move cust of cusmst to cust of cusflds-o.
0124.08 write display-record
0124.09 format is "cusflds"
0124.10 indicators are ws-screen-indicators.
0124.11 read customer-screen-file.
0135.00 *--------------------------------------------------------*
0135.01 2200-display-header.
0135.02 initialize cuspmt-i.
0135.04 write display-record
0135.05 format is "cuspmt"
0135.06 indicators are ws-screen-indicators.
0135.07 read customer-screen-file
0135.08 format is "cuspmt".

0136.00 z200-file-abend-process.
0137.00 display 'program name :' ws10-program-name.
0138.00 display 'file status :' ws10-file-status.
0139.00 display 'error message :' ws10-error-message.
0140.00 3000-termination-process.
0141.00 close customer-file.
0142.00 close customer-screen-file.
​​
[/code]
0 new messages