I'm trying to use the read() API to load the entire contents of a stream file into a variable defined a varchar(2000000). It works fine if I define the variable as char(2000000).
Basically, I'm missing the first 4 bytes of data when I pass the address of the varchar variable. I know this has something to do with the first (2 or 4) containing the size.. but I don't know how to account for it. I've tried several methods to no avail.
None of these work. The first and last option produce the data missing the first 4 characters. The middle option produces no data.
I need the stream file data in a variable to call Qc3CalculateHash to calculate the MD5 hash of the document.
I thought about just defining it as a character variable.... but it's so large..
Basically, I'm missing the first 4 bytes of data when I pass the address of the varchar variable. I know this has something to do with the first (2 or 4) containing the size.. but I don't know how to account for it. I've tried several methods to no avail.
Code:
[SIZE=2][COLOR=#ff0000][SIZE=2][COLOR=#ff0000]dcl-s[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] StmfData [/SIZE][SIZE=2][COLOR=#800000][SIZE=2][COLOR=#800000]varchar[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]2000000[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]);[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2]len [/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]=[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] read[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]fd[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]:[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%addr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]):[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%size[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080])+[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]4[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]);[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2]len [/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]=[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] read[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]fd[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]:[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%addr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData:*data[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]):[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%size[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080])[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]);[/COLOR][/SIZE][/COLOR][/SIZE] [SIZE=2]len [/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]=[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] read[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]fd[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]:[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%addr[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]):[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]%size[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]([/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]StmfData[/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080])[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#800080][SIZE=2][COLOR=#800080]);[/COLOR][/SIZE][/COLOR][/SIZE]
I need the stream file data in a variable to call Qc3CalculateHash to calculate the MD5 hash of the document.
I thought about just defining it as a character variable.... but it's so large..
Comment