Max Array Size in Basic
Posted: Tue Sep 18, 2007 1:17 am
I am attempting to understand one of the sample jobs provided with Datastage and have come accross the folllowing code:
*Get the maximum length of LONG column data
*If $mam is nonzero, use it to determine array size
IF ($mam NE 0) THEN
ARG1 = $mam*1048576
OPENSEQ PARAMETERFILE TO PFILE ELSE CALL DSLogInfo("File not found ":PARAMETERFILE:"", "JobControl")
READSEQ ColLength FROM PFILE ELSE CALL DSLogInfo("Error reading ":PARAMETERFILE:"", "JobControl")
DATALENGTH = TRIMB(ColLength)
CLOSESEQ PFILE
* 0.3 is a number of factor if there are only one DRS as source stage and
* another DRS as target stage. With more than two DRS stages in the ETL job,
* smaller number should be considered.
MAXMEM = ARG1*0.3
* 6000 is for rows size of other columns
ROWSIZE = DATALENGTH + 6000
* If the maximum length of the long column data exceeds MAXMEM,
* MAXMEM will be the column precision for ETL job
IF (DATALENGTH > MAXMEM) THEN
DATALENGTH = MAXMEM
END
ARRAYSIZE = DIV(MAXMEM, ROWSIZE)
IF (ARRAYSIZE < 1) THEN
ARG1 = 1
END
*32767 is the biggest arraysize allowed
IF (ARRAYSIZE > 32767) THEN
ARG1 = 32767
END
IF(ARRAYSIZE >= 1 AND ARRAYSIZE <= 32767) THEN
ARG1 = ARRAYSIZE
END
ARG2 = DATALENGTH
I have searched the documentation for array size limitation, for either dynamic or dimensioned arrays and couldn't find anything.
Could the 32767 mentioned here be referring to a signed half word
(UCS-2 characters, C int16_t, Java char, Java short) ?
Would be grateful for any enlightenment here...Thanks
*Get the maximum length of LONG column data
*If $mam is nonzero, use it to determine array size
IF ($mam NE 0) THEN
ARG1 = $mam*1048576
OPENSEQ PARAMETERFILE TO PFILE ELSE CALL DSLogInfo("File not found ":PARAMETERFILE:"", "JobControl")
READSEQ ColLength FROM PFILE ELSE CALL DSLogInfo("Error reading ":PARAMETERFILE:"", "JobControl")
DATALENGTH = TRIMB(ColLength)
CLOSESEQ PFILE
* 0.3 is a number of factor if there are only one DRS as source stage and
* another DRS as target stage. With more than two DRS stages in the ETL job,
* smaller number should be considered.
MAXMEM = ARG1*0.3
* 6000 is for rows size of other columns
ROWSIZE = DATALENGTH + 6000
* If the maximum length of the long column data exceeds MAXMEM,
* MAXMEM will be the column precision for ETL job
IF (DATALENGTH > MAXMEM) THEN
DATALENGTH = MAXMEM
END
ARRAYSIZE = DIV(MAXMEM, ROWSIZE)
IF (ARRAYSIZE < 1) THEN
ARG1 = 1
END
*32767 is the biggest arraysize allowed
IF (ARRAYSIZE > 32767) THEN
ARG1 = 32767
END
IF(ARRAYSIZE >= 1 AND ARRAYSIZE <= 32767) THEN
ARG1 = ARRAYSIZE
END
ARG2 = DATALENGTH
I have searched the documentation for array size limitation, for either dynamic or dimensioned arrays and couldn't find anything.
Could the 32767 mentioned here be referring to a signed half word
(UCS-2 characters, C int16_t, Java char, Java short) ?
Would be grateful for any enlightenment here...Thanks