|
| 1 | +System: |
| 2 | +Solve the following coding problem. Wrap your code answer using ``` |
| 3 | + |
| 4 | + |
| 5 | +Question: |
| 6 | +Translate the following cobol code to python: |
| 7 | + IF WS-DISPLAY-LINE = "* MQPUTSUB V1.0 " AND |
| 8 | + CA-RETURN-CODE = 0 AND |
| 9 | + WS-DEBUG = " " AND |
| 10 | + WS-COMM-QUEUE = "COMM BLOCK DATA" AND |
| 11 | + B100-NOT-RAN AND |
| 12 | + B117-NOT-RAN AND |
| 13 | + W500-RAN THEN |
| 14 | + DISPLAY "TEST 3 PASSED" |
| 15 | + ELSE |
| 16 | + DISPLAY "TEST 3 FAILED" |
| 17 | + END-IF |
| 18 | + INITIALIZE WS-COMM-BLOCK |
| 19 | + INITIALIZE WS-DISPLAY-LINE |
| 20 | + INITIALIZE WS-CONFIG-PARAMETERS |
| 21 | + INITIALIZE CA-MQPUTSUB-PARM |
| 22 | + SET DISCONNECT-ACTION TO TRUE |
| 23 | + SET TOGGLE-ERROR-FLAG TO TRUE |
| 24 | + MOVE "COMM BLOCK DATA" TO CA-COMM-BLOCK |
| 25 | + MOVE "QUEUE DATA" TO WS-QUEUE |
| 26 | + INITIALIZE SECTIONS-RUN |
| 27 | + PERFORM B000-INITIALISE. |
| 28 | + IF WS-DISPLAY-LINE = "* MQPUTSUB V1.0 " AND |
| 29 | + CA-RETURN-CODE = 0 AND |
| 30 | + WS-DEBUG = " " AND |
| 31 | + WS-COMM-QUEUE = "COMM BLOCK DATA" AND |
| 32 | + B100-NOT-RAN AND |
| 33 | + B117-NOT-RAN AND |
| 34 | + W500-RAN THEN |
| 35 | + DISPLAY "TEST 4 PASSED" |
| 36 | + ELSE |
| 37 | + DISPLAY "TEST 4 FAILED" |
| 38 | + END-IF. |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | +Answer: |
| 43 | +```python |
| 44 | +if ws_display_line == "* MQPUTSUB V1.0 " and ca_return_code == 0 and ws_debug == " " and ws_comm_queue == "COMM BLOCK DATA" and b100_not_ran and b117_not_ran and w500_ran: |
| 45 | + print("TEST 3 PASSED") |
| 46 | +else: |
| 47 | + print("TEST 3 FAILED") |
| 48 | + |
| 49 | +initialize_ws_comm_block() |
| 50 | +initialize_ws_display_line() |
| 51 | +initialize_ws_config_parameters() |
| 52 | +initialize_ca_mqputsub_parm() |
| 53 | +set_disconnect_action(True) |
| 54 | +set_toggle_error_flag(True) |
| 55 | +ca_comm_block = "COMM BLOCK DATA" |
| 56 | +ws_queue = "QUEUE DATA" |
| 57 | +initialize_sections_run() |
| 58 | +perform_b000_initialise() |
| 59 | + |
| 60 | +if ws_display_line == "* MQPUTSUB V1.0 " and ca_return_code == 0 and ws_debug == " " and ws_comm_queue == "COMM BLOCK DATA" and b100_not_ran and b117_not_ran and w500_ran: |
| 61 | + print("TEST 4 PASSED") |
| 62 | +else: |
| 63 | + print("TEST 4 FAILED") |
| 64 | + |
| 65 | +``` |
0 commit comments