How to use JSL how to modify decimal numbers to binary data in this format?Hello!
How to use JSL how to modify decimal numbers to binary data in this format?
Thanks!
000903
999999

Advanced Statistical ModelingAutomation and ScriptingMass CustomizationWindowsRe: How to use JSL how to modify decimal numbers to binary data in this format?Sorry, I've been wrong, Load/Save Text File supports BLOB, see scripting index. But I think anything else is going wrong during file operation. Below JSL with option for reading BLOB.
Names Default To Here( 1 );
tem = {"000903", "999999"};
b = "0100";
c = "0000000000000000000000000000000000";
d = "";
j = 1;
For( j = 1, j <= N Items( tem ), j++,
a = tem[j];
theHex = "";
i = 1;
While( Substr( a, i, 1 ) != "",
theHex = theHex || Hex( Substr( a, i, 1 ) );
i++;
);
d = d || b || theHex || c;
);
Show( d );
Show( "d = 0100303030393033000000000000000000000000000000000001003939393939390000000000000000000000000000000000" );
filename = Save Text File( "$TEMP\try1.dat", Hex To Blob( d ) );
text = Load Text File( filename, BLOB );
Show( (Blob To Char( text )) );Re: How to use JSL how to modify decimal numbers to binary data in this format?@lala , it's really hard to follow you, what you do and what you want. I think the suggestion of Jim is fine, and your problem is not in JSL but in file operations.
My feeling is that you shouldn't write binary data in a text file. If this would work, you should be able to re-read it, but this is not the case, JMP throws an errror.
Names Default To Here( 1 );
tem = {"000903", "999999"};
b = "0100";
c = "0000000000000000000000000000000000";
d = "";
j = 1;
For( j = 1, j <= N Items( tem ), j++,
a = tem[j];
theHex = "";
i = 1;
While( Substr( a, i, 1 ) != "",
theHex = theHex || Hex( Substr( a, i, 1 ) );
i++;
);
d = d || b || theHex || c;
);
Show( d );
Show( "d = 0100303030393033000000000000000000000000000000000001003939393939390000000000000000000000000000000000" );
filename = Save Text File( "TEMP\try1.dat", Hex To Blob( d ) );
text = Load Text File( filename );
Show( (Blob To Char( text )) );Re: How to use JSL how to modify decimal numbers to binary data in this format?d="0100303030393033000000000000000000000000000000000001003939393939390000000000000000000000000000000000"
d="0100303030393033000000000000000000000000000000000001003939393939390000000000000000000000000000000000"
Re: How to use JSL how to modify decimal numbers to binary data in this format?d="0100303030393033000000000000000000000001003939393939390000000000000000000000"
I don't understand 34=OK and 33=wrong
Re: How to use JSL how to modify decimal numbers to binary data in this format?c = "0000000000000000000000000000000000";
34——OK
c = "0000000000000000000000";
22——wrong
Re: How to use JSL how to modify decimal numbers to binary data in this format?

Re: How to use JSL how to modify decimal numbers to binary data in this format?Thank Jim!
So I understand the principle of calculation.But I still can't figure out how to end up adding something else and saving it in this format.
Thanks Experts!

Re: How to use JSL how to modify decimal numbers to binary data in this format?This is just a conversion to Hex
Names Default To Here( 1 );
a = "000903";
theHex = "";
i = 1;
While( Substr( a, i, 1 ) != "",
theHex = theHex || Hex( Substr( a, i, 1 ) );
i++;
);
Show( theHex );
This returns
theHex = "303030393033";
Re: How to use JSL how to modify decimal numbers to binary data in this format?D:\E\download1.dat