Skip to content

Commit

Permalink
Merged develop
Browse files Browse the repository at this point in the history
  • Loading branch information
davidepalladino-apuliasoft committed Mar 20, 2024
2 parents 17e1230 + 43897c9 commit 1274d0c
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,13 @@ class FieldsList(val fields: List<FieldInfo>) {
if (field.startOffset == null) {
if (field.overlayInfo == null) {
if (index > 0) {
val prevField = fields[index - 1]
if (prevField.endOffsetIncludingAllElement != null) {
field.startOffset = prevField.endOffsetIncludingAllElement
var step = index
while (step > 0) {
val prevField = fields[--step]
if (prevField.endOffsetIncludingAllElement != null) {
field.startOffset = prevField.endOffsetIncludingAllElement
break
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import org.junit.Test
import kotlin.test.assertEquals

open class MULANGT02ConstAndDSpecTest : MULANGTTest() {
/**
* Data reference - DS with 2 arrays defined with overlay
* @see #247
*/
@Test
fun executeT02_A40_P03() {
val expected = listOf("CNCLICNCLIAAAABBBBBAAAABBBBBCNFORCNFORCCCCDDDDDCCCCDDDDDCNCOLCNCOLEEEEFFFFFEEEEFFFFF")
assertEquals(expected, "smeup/T02_A40_P03".outputOf())
}

/**
* Data reference - Inline definition
* @see #250
Expand All @@ -23,4 +33,14 @@ open class MULANGT02ConstAndDSpecTest : MULANGTTest() {
val expected = listOf("A50_A3( ) A50_A4( )")
assertEquals(expected, "smeup/T02_A50_P02".outputOf())
}

/**
* Data reference - Definition both inline and file
* @see #253
*/
@Test
fun executeT02_A80_P04() {
val expected = listOf("ABCDEFGHIJ")
assertEquals(expected, "smeup/T02_A80_P04".outputOf(configuration = smeupConfig))
}
}
40 changes: 40 additions & 0 deletions rpgJavaInterpreter-core/src/test/resources/smeup/T02_A40_P03.rpgle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
D DS
D A40_DS10A 5 DIM(3)
D DS10A_FL1 2 OVERLAY(A40_DS10A:01)
D DS10A_FL2 3 OVERLAY(A40_DS10A:*NEXT)
D A40_DS10B 9 DIM(3)
D DS10B_FL1 4 OVERLAY(A40_DS10B:01)
D DS10B_FL2 5 OVERLAY(A40_DS10B:*NEXT)
D £DBG_Str S 150 VARYING

C EVAL DS10A_FL1(1)='CN'
C EVAL DS10A_FL2(1)='CLI'
C EVAL DS10B_FL1(1)='AAAA'
C EVAL DS10B_FL2(1)='BBBBB'
C EVAL DS10A_FL1(2)='CN'
C EVAL DS10A_FL2(2)='FOR'
C EVAL DS10B_FL1(2)='CCCC'
C EVAL DS10B_FL2(2)='DDDDD'
C EVAL DS10A_FL1(3)='CN'
C EVAL DS10A_FL2(3)='COL'
C EVAL DS10B_FL1(3)='EEEE'
C EVAL DS10B_FL2(3)='FFFFF'
C EVAL £DBG_Str=%TRIM(A40_DS10A(1))+
C %TRIM(DS10A_FL1(1))+
C %TRIM(DS10A_FL2(1))+
C %TRIM(A40_DS10B(1))+
C %TRIM(DS10B_FL1(1))+
C %TRIM(DS10B_FL2(1))+
C %TRIM(A40_DS10A(2))+
C %TRIM(DS10A_FL1(2))+
C %TRIM(DS10A_FL2(2))+
C %TRIM(A40_DS10B(2))+
C %TRIM(DS10B_FL1(2))+
C %TRIM(DS10B_FL2(2))+
C %TRIM(A40_DS10A(3))+
C %TRIM(DS10A_FL1(3))+
C %TRIM(DS10A_FL2(3))+
C %TRIM(A40_DS10B(3))+
C %TRIM(DS10B_FL1(3))+
C %TRIM(DS10B_FL2(3))
C £DBG_Str DSPLY
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DCQNCOG E DS EXTNAME(CQNCOG0F) INZ
D £DBG_Str S 50 VARYING

C CLEAR N§PROG 10
C EVAL N§PROG = 'ABCDEFGHIJ'
C EVAL £DBG_Str=%TRIM(N§PROG)
C £DBG_Str DSPLY

0 comments on commit 1274d0c

Please sign in to comment.