midrange.com code scratchpad |
Name:
OCCURSDEP
|
Scriptlanguage:
Plain Text
|
Tabwidth:
4
|
Date:
06/11/2009 07:50:13 pm
|
IP:
Logged
|
|
Description:
Example combining OCCURS DEPENDING with LINKAGE SECTION "based" definitions.
|
Code:
- PROCESS APOST
- Identification Division.
- Program-ID. OCCURSDEP.
-
- Environment Division.
- Configuration Section.
- Source-computer. IBM-AS400.
- Object-computer. IBM-AS400.
- /
- Data Division.
-
- Working-storage Section.
-
- 77 subtext PIC x(1200).
- 77 SQL-TEXT PIC x(1024)
- value 'Here is enough text to play with.'.
- 77 pSQL pointer.
-
- 01 SQL-struct.
- 05 SQL-STATEMENT-TEXT-LEN2 PIC S9(00009) BINARY.
-
- Linkage Section.
-
- 01 SQL-STATEMENT-TEXT2-struct.
- 05 SQL-STATEMENT-TEXT2 PIC X
- OCCURS 1 TO 1024 TIMES
- DEPENDING ON
- SQL-STATEMENT-TEXT-LEN2.
- Procedure Division.
-
- 0000-Main Section.
- 0010-MainLine.
-
- set pSQL to address of SQL-TEXT
- set address of SQL-STATEMENT-TEXT2-struct to pSQL
-
- compute SQL-STATEMENT-TEXT-LEN2 = 19
-
- string SQL-STATEMENT-TEXT2-struct delimited SIZE
- '<end' delimited SIZE
- into
- subtext
- end-string
-
- display subtext
-
- GOBACK
- .
-
|
|
|