Aschenbrenner, Poul wrote:
I have now get the string with file name created in IFS.
But the file name have some strangers hex char in the start
of varible MyFile. ??
Here is my sample exit program. What can I do to remove
the starting hex char. ex. x'0028' it look like it has
some form off lengt of the variable.
Is this normal when setting variable VARYING.
I can se this in the CL program that i Call.
Poul:
It is normal for a VARYING field to have a 2-byte length value in
memory just before the first data byte. If you pass that field to an
ILE CL procedure, you might handle it like this:
pgm ( &pfile )
dcl &pfile *char 256 /* Has length pre-pended */
dcl &lpfile *int 2
dcl &file *char 254 /* This one does NOT have length */
chgvar &lpfile %bin( &pfile 1 2 ) /* Extract length bytes */
chgvar &file %sst( &pfile 3 &lpfile ) /* Start in 3 */
You can extract the length into a numeric variable and use the
length to extract a fixed-length copy of the data in the field.
You don't always have to extract into a separate fixed-length
variable. Sometimes it makes sense just to use the substring
expression itself or to pass the VARYING variable unchanged.
There are always different ways to do things, but this tiny example
might help see what happens.
Note that CL can essentially _generate_ a VARYING value by reversing
the process. Place the value starting in byte 3, and then place the
2-byte length in bytes 1 & 2. Then pass the entire string.
Tom Liotta
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.