Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update cics delay statement as per doc #2241

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ METADATA : M E T A D A T A;
METADATALEN : M E T A D A T A L E N;
METHOD : M E T H O D;
METHODLENGTH : M E T H O D L E N G T H;
MILLISECS: M I L L I S E C S;
MILLISECONDS : M I L L I S E C O N D S;
MINIMUM : M I N I M U M;
MINUTES : M I N U T E S;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ cics_define_at: AT (HOURS cics_data_value | MINUTES cics_data_value | SECONDS ci
cics_define_on: ON YEAR cics_data_value (MONTH cics_data_value DAYOFMONTH cics_data_value | DAYOFYEAR cics_data_value) cics_handle_response?;

/** DELAY */
cics_delay: DELAY (INTERVAL cics_zero_digit | INTERVAL cics_hhmmss | TIME cics_hhmmss | cics_delay_for | REQID cics_name | cics_handle_response)+;
cics_delay_for: (FOR | UNTIL) (HOURS cics_data_value | MINUTES cics_data_value | SECONDS cics_data_value)+;
cics_delay: DELAY (INTERVAL cics_zero_digit | INTERVAL cics_hhmmss | TIME cics_hhmmss | cics_delay_for | cics_dealy_until | REQID cics_name | cics_handle_response)+;
cics_delay_for: FOR (HOURS cics_data_value | MINUTES cics_data_value | SECONDS cics_data_value | MILLISECS cics_data_value)+;
cics_dealy_until: UNTIL (HOURS cics_data_value | MINUTES cics_data_value | SECONDS cics_data_value)+;

/** DELETE (all of them) */
cics_delete: DELETE (cics_delete_file | ACTIVITY cics_data_value | cics_delete_container | cics_delete_counter |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2024 Broadcom.
* The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Broadcom, Inc. - initial API and implementation
*
*/
package org.eclipse.lsp.cobol.usecases;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.eclipse.lsp.cobol.test.engine.UseCaseEngine;
import org.junit.jupiter.api.Test;

/** Test CICS DELAY statement as per https://www.ibm.com/docs/en/cics-ts/6.1?topic=summary-delay */
public class TestCicsDelayStatement {
private static final String PREFIX =
" IDENTIFICATION DIVISION.\n"
+ " PROGRAM-ID. TEXTEX.\n"
+ " DATA DIVISION.\n"
+ " WORKING-STORAGE SECTION.\n"
+ " 01 {$*CHECK} pic x(9).\n"
+ " PROCEDURE DIVISION.\n";
public static final String TEXT =
PREFIX
+ " EXEC CICS \n"
+ " DELAY FOR MILLISECS(500) REQID({$CHECK})\n"
+ " NOHANDLE \n"
+ " END-EXEC.";

public static final String TEXT2 =
PREFIX
+ " EXEC CICS \n"
+ " DELAY INTERVAL({$CHECK}) REQID({$CHECK})\n"
+ " NOHANDLE \n"
+ " END-EXEC.";

public static final String TEXT3 =
PREFIX
+ " EXEC CICS \n"
+ " DELAY UNTIL HOURS(500) MINUTES(800) REQID({$CHECK})\n"
+ " NOHANDLE \n"
+ " END-EXEC.";

@Test
void test_delayStatement_flow1() {
UseCaseEngine.runTest(TEXT, ImmutableList.of(), ImmutableMap.of());
}

@Test
void test_delayStatement_flow2() {
UseCaseEngine.runTest(TEXT2, ImmutableList.of(), ImmutableMap.of());
}

@Test
void test_delayStatement_flow3() {
UseCaseEngine.runTest(TEXT3, ImmutableList.of(), ImmutableMap.of());
}
}
Loading