Tuesday, January 26, 2010

Decimal Data Error and Copy DDS file to Flat File

d var1 S 5P 0
d var2 S 5A Inz('12345')
d var3 S 5A Inz('12a45')
/free
var1 = %int(var2); //doe not give any error
var1 = %int(var3); //it give you an runtime error since var3 conatins 'a' which is non numeric
*inlr = *on;
/end-free

to avoid such runtime errors
/free
testne(var3);
if %error ;
// leave it
else;
var1 = %int(var3);
endif;
*inlr = *on;
/end-free


How To copy DDS File to Flat file
use below command

CPYTOIMPF FROMFILE(FRMLIB/PF1) TOFILE(TOLIB/FLAT1) MBROPT(*REPLACE)
RCDDLM(*EOR) DTAFMT(*FIXED) STRDLM(*NONE) STRESCCHR(*NONE)

No comments:

Post a Comment