Skip to content

Commit

Permalink
fix: update cics delay statement as per doc
Browse files Browse the repository at this point in the history
update cics delay statement as per doc.
Ref: https://www.ibm.com/docs/en/cics-ts/6.1?topic=summary-delay

Signed-off-by: Aman Prashant <aman.prashant@broadcom.com>
  • Loading branch information
ap891843 committed Mar 6, 2024
1 parent 3dcd0f5 commit 3aed670
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,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 @@ -319,8 +319,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());
}
}

0 comments on commit 3aed670

Please sign in to comment.