Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Chemstation : string array problems

3 views
Skip to first unread message

no_spam...@pandora.be

unread,
Jul 1, 2002, 7:09:25 PM7/1/02
to
Hi,

For developing Chemstation macros
I use an office computer (Win 98) equipped with
Enhanced Chemstation G1701 BA Version B.01.00.
The lab computer, where the macros are eventually used,
is a Win NT with Enhanced Chemstation B1701 CA Version C.00.00.
(Writing from home, I now have some doubt about B1701 vs G1701,
anyway, they ARE the B and C version)

There is one macro that has run w/o problems for some time
but now suddenly gave problems with 2 chromatograms
in which more than 500 peaks are found.
After counting the peaks, the macro assigns arrays for storing data
with DIM statements (for numbers) or DIM + SDIM statements (for strings).

There is no problem on the B version but the C version (Win NT) terminates
with "A string array can have between 0 and 500 elements".
I could not find anything on this restriction in the on-line documentation,
and therefore I am still wondering why this is specific for the C version.

I am now delving through old data to find >500-peak chromatograms
and I find a few, but unfortunetaly I cannot trace back with which
version (i.e. computer) they were handled (we live, we learn, I will
implement that)
Any reason why a change in the NT-environment could have provoked
this restriction ? (memory ??)

I fear I will have to redesign the macro (dumping the strings to a file,
instead of collecting in memory) but this seems cumbersome
and I would prefer to avoid it.
(In short : data are collected in a non-linear mode, most of the
data are retrieved from the TIC, and later, the gaps are filled
by scanning through all possible SICs - performing this scan each time
data are missing would be quite time-consuming).

TIA

Johan

Tobias Kind

unread,
Jul 2, 2002, 7:18:57 AM7/2/02
to
no_spam...@pandora.be wrote in message news:<3D20E13A...@pandora.be>...


Hallo Johan,

* DIM variable name, scalar1 [,scalar2]

A normal DIM-Array must contain 1 - 96k elements (or exact 98304)
This is defined in cpres.dll and cpres32.dll.

Example:
DIM myarray,98304
DIM bigarray, 313,313

---------------------------------------------

* SDIM variable name, scalar1

SDIM is defined in all "init macros" (i.e. top.mac)
It is not hardcoded!

!
! macro to dimension string arrays
!
Name sdim
parameter x byname foo, size default 2
local i
i=1
while i < size
local b$
join x,b$
i=i+1
endwhile
return

Example:
sdim labels$,6

---------------------------------------------

Name tk_sdim
!test for string array > 500
!run with
!macro "tk_sdim.mac",go

local i,x
i=1
size = 15000
while i < size
local b$
b$ = "astalavista baby " + val$(i)
join x,b$
i=i+1
print "Array[",i-1,"] = "x[i]
endwhile

! Array starts from zero
! proof content
print "Array[",0,"] = "x[1]
sleep 1
print "Array[",i-1,"] = "x[i]
sleep 1
print "Array x = ",x
sleep 1
b$ = x[i]
print b$
return

---------------------------------------------

Now if you want to proof if there are arrays
with more than 500 elements try tk_sdim.mac
Save the follwoing example to "tk_sdim.mac"
and execute it at the command line.

As you can see, you can store more than 500
elements. It is not a problem of the SDIM
definition....... Debug the macro
and have a look where it cracks up.

With kind regards
Tobias Kind
www.amdis.net

PS:
Some HP Chemstation infos:
http://www.amdis.net/external/external.html

nospam_...@pandora.be

unread,
Jul 2, 2002, 7:39:45 PM7/2/02
to

Tobias Kind wrote:

>
> SDIM is defined in all "init macros" (i.e. top.mac)
> It is not hardcoded!

Hi Tobias,

Thanks for your suggestion.
I will look into it tomorrow at work.
Intuitively, I thought that the SDIM statement
was so involved with memory managment that I always considered
it to be a very low-level routine - not a macro.
On the other hand, my Macropad log showed the following

SDim gTable, gNPeaks
if size >= 2
strdim x,size
7/1/2002 11:10:22
Macro: SDIM, Cmd: strdim x,size
Msg:

A string array can have between 0 and 500 elements

The "if size >= 2" does not seem to occur in your citation
but I will check in my version.
BTW : my macro runs in the offline data processing level
not the (online) top level.
I guess I will have to look for a 'strdim' macro somewhere...

Thanks again

Johan

Tobias Kind

unread,
Jul 5, 2002, 4:24:28 AM7/5/02
to
nospam_...@pandora.be wrote in message news:<3D2239D9...@pandora.be>...

..snip


> Macro: SDIM, Cmd: strdim x,size
> Msg:
> A string array can have between 0 and 500 elements

...snip


> I guess I will have to look for a 'strdim' macro somewhere...

Dear Johan,

yes but STRDIM is also hardcoded.
Its better you use one of these simple
macro definitions, because there are
no such limitations.

nospam_...@pandora.be

unread,
Jul 6, 2002, 4:00:04 PM7/6/02
to

Hi Tobias,

[I had already composed this message at work,
where I don't have Usenet access before I saw your last reply]

I finally had the time to have another look at the SDIM problem.
The errorlog indicates that the SDIM problem is in fact a strdim problem
(which is absent in the top.mac definition that you gave)

A few brute searches through the folders

B-version
"strdim" : 5 matches (4 executables, Mstop.exe, Msinsctl.exe,
Msconfig.exe, Msda.exe
and in 1 documentary file, Commands.txt, well :"documentation" as in
"enumeration")
"name strdim" : none
"name sdim" : 48 occurences !!!!

C version
"strdim" : many (macros seem to call it directly, avoiding the trip to
sdim)
"name strdim" : none
"name sdim" : 11 occurences

Some of the "name sdim" occurrences are in fact the old code (e.g. in
top.mac)
But in msda.mac (I assume this is the top for the MS Data Analysis
program where my macro runs) :

! macro to dimension string arrays for backwards compatability
! for 3.9 use STRDIM for all string arrays.

Name sdim
parameter x byname foo, size default 2

if size >= 2
strdim x,size

endif
return

According to your suggestion, I added a copy of the old SDIM (changing
the
name to avoid overwriting the original one) and call that copy for
setting
up my string arrays.

B-version : runs well, no problem
C-version : now I get another error (in the first cycle of my local
SDIM)...

Dim gPkNameTable1, gNPeaks
Array gPkNameTable1(716) has been created
VOCsdim gPkNameTable1, gNPeaks !<= here I call my SDIM copy
local i
i=1
1

while i < size
local b$
join x,b$

7/5/2002 14:11:28
Macro: VOCSDIM, Cmd: join x,b$
Msg: One of the arguments to JOIN is of the wrong type.

As a reminder here is the old SDIM source

Name sdim
parameter x byname foo, size default 2

i=1
While i < size
Local i, b$

join x,b$
i=i+1
endwhile
return

Was the SDIM change prompted by a change in JOIN ? Maybe...

I had a look at the 450-page "HP Chemstation Macro Programming Guide"
sdim : nil
strdim : nil
join : nil
array : mostly in combination with "diode"
According to the online help "join" acts on "objects"
In the Guide "objects" are "chromatograms, spectra, matrices or
user-defined objects"
Not (or no longer) string arrays ???

Chemstation programming, I suppose you have to LEARN to love it,
it certainly doesn't come at first sight ;-))
I am now redesigning the macro so that I can avoid the string array...

Regards

Johan
(and thanks for your interest in my problem)

0 new messages