Debian Codegraph @

gcc/testsuite/cobol.dg/group2/FUNCTION_BIGGER-POINTER.cob

raw
1 *> { dg-do run }
2 *> { dg-options "-dialect ibm" }
3 *> { dg-output-file "group2/FUNCTION_BIGGER-POINTER.out" }
4
5 IDENTIFICATION DIVISION.
6 PROGRAM-ID. prog.
7 DATA DIVISION.
8 WORKING-STORAGE SECTION.
9 01 N PIC S9(8) COMP-5 value 0.
10 01 P REDEFINES N POINTER.
11 01 FILLER.
12 05 X PIC A(4) VALUE "ABC".
13 05 E REDEFINES X PIC A(1) OCCURS 4.
14 LINKAGE SECTION.
15 77 B PIC A.
16
17 PROCEDURE DIVISION.
18 set P to address of E(1).
19
20 display FUNCTION trim(x) '.'
21
22 set address of B to p.
23 perform until B = SPACE
24 display B no advancing
25 set p up by 1
26 set address of B to p
27 end-perform
28 display '.'
29
30 set P to address of E(1)
31 set address of B to p
32 perform until B = SPACES
33 display B no advancing
34 add 1 to N
35 set address of B to p
36 end-perform
37 display '.'
38
39 STOP RUN.
40