Skip to content

Commit b3fff05

Browse files
authored
Merge pull request #14 from flaviabeo/cobol_translation
Adds cobol translation prompts
2 parents 4c1fdd1 + a7c7eca commit b3fff05

File tree

12 files changed

+556
-0
lines changed

12 files changed

+556
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
MOVE 'HELLO WORLD' TO VA-TAB
8+
MOVE '45' TO CA-PAYMENT
9+
IF MAN-BOOKER IS EQUAL TO 24
10+
EXEC SQL
11+
INSERT INTO ADDR
12+
( NUMBER,
13+
NAME)
14+
VALUES ( :SAN-NUM,
15+
:SHAP-VALUE)
16+
END-EXEC
17+
IF SQLCODE NOT EQUAL 0
18+
PERFORM TRAN-RATE-INTERVAL
19+
EXEC STATEMENT1 END-EXEC
20+
END-IF
21+
ENDIF
22+
EXEC SQL
23+
SET :SAN-NUM = IDENTITY_VAL_LOCAL()
24+
END-EXEC
25+
26+
MOVE SAN-NUM TO PY-RES-INT
27+
MOVE 25 TO MAN-BOOKER
28+
MOVE 20 TO AGE
29+
DISPLAY AGE
30+
EXIT.
31+
32+
33+
Answer:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 CAN-BANK-VAL IS EQUAL TO 87
8+
EXEC SQL
9+
INSERT INTO BANK
10+
( NUM,
11+
LOCATION)
12+
VALUES ( DEFAULT,
13+
:SYS-GERM)
14+
END-EXEC
15+
IF SQLCODE NOT EQUAL 0
16+
MOVE '10' TO CA-SUM-ASSURED
17+
PERFORM PRINT-FUNCTION
18+
EXEC STATEMENT2 END-EXEC
19+
END-IF
20+
END-IF
21+
EXIT.
22+
23+
24+
Answer:
25+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
System:
2+
Solve the following coding problem. Wrap your code answer using ```
3+
4+
5+
Question:
6+
Translate code from cobol to java:
7+
8+
DEMO-TASKA.
9+
MOVE 'HELLO WORLD' TO VA-TAB
10+
MOVE '45' TO CA-PAYMENT
11+
IF MAN-BOOKER IS EQUAL TO 24
12+
EXEC SQL
13+
INSERT INTO ADDR
14+
( NUMBER,
15+
NAME)
16+
VALUES ( :SAN-NUM,
17+
:SHAP-VALUE)
18+
END-EXEC
19+
IF SQLCODE NOT EQUAL 0
20+
PERFORM TRAN-RATE-INTERVAL
21+
EXEC STATEMENT1 END-EXEC
22+
END-IF
23+
ENDIF
24+
EXEC SQL
25+
SET :SAN-NUM = IDENTITY_VAL_LOCAL()
26+
END-EXEC
27+
28+
MOVE SAN-NUM TO PY-RES-INT
29+
MOVE 25 TO MAN-BOOKER
30+
MOVE 20 TO AGE
31+
DISPLAY AGE
32+
EXIT.
33+
34+
35+
Answer:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
System:
2+
Solve the following coding problem. Wrap your code answer using ```
3+
4+
5+
Question:
6+
Translate code from cobol to java:
7+
8+
BUZZ-VAL.
9+
IF CAN-BANK-VAL IS EQUAL TO 87
10+
EXEC SQL
11+
INSERT INTO BANK
12+
( NUM,
13+
LOCATION)
14+
VALUES ( DEFAULT,
15+
:SYS-GERM)
16+
END-EXEC
17+
IF SQLCODE NOT EQUAL 0
18+
MOVE '10' TO CA-SUM-ASSURED
19+
PERFORM PRINT-FUNCTION
20+
EXEC STATEMENT2 END-EXEC
21+
END-IF
22+
END-IF
23+
EXIT.
24+
25+
26+
Answer:
27+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
System:
2+
Solve the following coding problem. Wrap your code answer using ```
3+
4+
5+
Question:
6+
Translate code from cobol to java:
7+
DIF 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+
Answer:
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
MOVE 'HELLO WORLD' TO VA-TAB
8+
MOVE '45' TO CA-PAYMENT
9+
IF MAN-BOOKER IS EQUAL TO 24
10+
EXEC SQL
11+
INSERT INTO ADDR
12+
( NUMBER,
13+
NAME)
14+
VALUES ( :SAN-NUM,
15+
:SHAP-VALUE)
16+
END-EXEC
17+
IF SQLCODE NOT EQUAL 0
18+
PERFORM TRAN-RATE-INTERVAL
19+
EXEC STATEMENT1 END-EXEC
20+
END-IF
21+
ENDIF
22+
EXEC SQL
23+
SET :SAN-NUM = IDENTITY_VAL_LOCAL()
24+
END-EXEC
25+
26+
MOVE SAN-NUM TO PY-RES-INT
27+
MOVE 25 TO MAN-BOOKER
28+
MOVE 20 TO AGE
29+
DISPLAY AGE
30+
EXIT.
31+
32+
33+
Answer:
34+
```python
35+
va_tab = 'HELLO WORLD'
36+
ca_payment = '45'
37+
38+
if man_booker == 24:
39+
try:
40+
with sqlite3.connect('example.db') as conn:
41+
cursor = conn.cursor()
42+
cursor.execute("INSERT INTO ADDR (NUMBER, NAME) VALUES (?, ?)", (san_num, shap_value))
43+
conn.commit()
44+
except sqlite3.Error as e:
45+
print(f"Error: {e}")
46+
perform_tran_rate_interval()
47+
finally:
48+
cursor.close()
49+
50+
try:
51+
with sqlite3.connect('example.db') as conn:
52+
cursor = conn.cursor()
53+
cursor.execute("SET ?", (san_num,))
54+
conn.commit()
55+
except sqlite3.Error as e:
56+
print(f"Error: {e}")
57+
finally:
58+
cursor.close()
59+
60+
py_res_int = san_num
61+
man_booker = 25
62+
age = 20
63+
print(age)
64+
exit()
65+
66+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 CAN-BANK-VAL IS EQUAL TO 87
8+
EXEC SQL
9+
INSERT INTO BANK
10+
( NUM,
11+
LOCATION)
12+
VALUES ( DEFAULT,
13+
:SYS-GERM)
14+
END-EXEC
15+
IF SQLCODE NOT EQUAL 0
16+
MOVE '10' TO CA-SUM-ASSURED
17+
PERFORM PRINT-FUNCTION
18+
EXEC STATEMENT2 END-EXEC
19+
END-IF
20+
END-IF
21+
EXIT.
22+
23+
24+
Answer:
25+
```python
26+
if can_bank_val == 87:
27+
try:
28+
with sqlite3.connect('example.db') as conn:
29+
cursor = conn.cursor()
30+
cursor.execute("INSERT INTO BANK (NUM, LOCATION) VALUES (DEFAULT, ?)", (sys_germ,))
31+
conn.commit()
32+
except sqlite3.Error as e:
33+
print(f"Error: {e}")
34+
ca_sum_assured = '10'
35+
perform_print_function()
36+
finally:
37+
cursor.close()
38+
exit()
39+
40+
```
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)