70 lines
2.2 KiB
Plaintext
70 lines
2.2 KiB
Plaintext
|
*******************************************************************************
|
||
|
*
|
||
|
* uniVerse port of PI/open MATBLOCK statement
|
||
|
*
|
||
|
* Module %M% Version %I% Date %H%
|
||
|
*
|
||
|
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
|
||
|
* This is unpublished proprietary source code of Ardent Software Inc.
|
||
|
* The copyright notice above does not evidence any actual or intended
|
||
|
* publication of such source code.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
*
|
||
|
* Maintenance log - insert most recent change descriptions at top
|
||
|
*
|
||
|
* Date.... GTAR# WHO Description.........................................
|
||
|
* 10/14/98 23801 SAP Change copyrights.
|
||
|
* 02/01/93 10966 PVW Allow SQL NULL as element in multivalued data
|
||
|
* 12/18/92 10757 PVW Change editor special character handling.
|
||
|
* 11/12/92 10214 PVW Port PI/open EDITOR to replace uniVerse EDITOR.
|
||
|
*
|
||
|
*******************************************************************************
|
||
|
|
||
|
SUBROUTINE MATBLOCK(MAT MEMORY,DYNAMIC.ARRAY,DELIMETER,LINES.PER.CELL)
|
||
|
|
||
|
MAT MEMORY = ""
|
||
|
CHAR.NUMBER = SEQ(DELIMETER)
|
||
|
CHAR.MAX = 256
|
||
|
CURRENT.CELL = 1
|
||
|
LINES.IN.CELL = 0
|
||
|
TEXT = ""
|
||
|
LAST.DELIMETER = ""
|
||
|
|
||
|
LOOP
|
||
|
|
||
|
REMOVE TOKEN FROM DYNAMIC.ARRAY SETTING TEXT.DELIMETER
|
||
|
|
||
|
IF ISNULL(TOKEN) THEN TOKEN = @NULL.STR
|
||
|
TEXT.DELIMETER = CHAR.MAX - TEXT.DELIMETER
|
||
|
TEXT = TEXT:LAST.DELIMETER:TOKEN
|
||
|
|
||
|
BEGIN CASE
|
||
|
|
||
|
CASE TEXT.DELIMETER = 255 AND DELIMETER = @FM
|
||
|
* for segment marks within data keep on the same line
|
||
|
LAST.DELIMETER = CHAR(TEXT.DELIMETER)
|
||
|
|
||
|
CASE TEXT.DELIMETER >= CHAR.NUMBER
|
||
|
IF LINES.IN.CELL = LINES.PER.CELL
|
||
|
THEN
|
||
|
CURRENT.CELL = CURRENT.CELL + 1
|
||
|
LINES.IN.CELL = 0
|
||
|
END
|
||
|
|
||
|
LINES.IN.CELL = LINES.IN.CELL + 1
|
||
|
MEMORY(CURRENT.CELL)<LINES.IN.CELL> = TEXT
|
||
|
TEXT = ""
|
||
|
LAST.DELIMETER = ""
|
||
|
|
||
|
CASE 1
|
||
|
LAST.DELIMETER = CHAR(TEXT.DELIMETER)
|
||
|
|
||
|
END CASE
|
||
|
|
||
|
UNTIL TEXT.DELIMETER = CHAR.MAX DO
|
||
|
REPEAT
|
||
|
|
||
|
RETURN
|
||
|
END
|