Page 1 of 1

How to convert unsigned comp-3 to numeric value

PostPosted: Tue Mar 05, 2013 6:39 pm
by ssgan
How to convert unsigned comp-3 to numeric value?
i.e. 9(6) comp-3 to 9(6).

I tried with the following sort, it gave the S0C7 abend.

SORT FIELDS=COPY
OUTREC FIELDS=(47,4,PD,EDIT=(TTTTTT))

Re: How to convert unsigned comp-3 to numeric value

PostPosted: Tue Mar 05, 2013 6:45 pm
by BillyBoyo
Well, that should work if 47 is the correct starting position of your field. Is you file VB? Did you take account of the RDW, by adding four to the start position, giving 51?

Otherwise, show a few lines of your input data, with HEX ON, in the Code tags please.

Re: How to convert unsigned comp-3 to numeric value

PostPosted: Tue Mar 05, 2013 7:07 pm
by ssgan
its FB file only.

Re: How to convert unsigned comp-3 to numeric value

PostPosted: Tue Mar 05, 2013 7:58 pm
by BillyBoyo
  OPTION COPY
  INCLUDE COND=(47,4,PD,NE,NUM)


Run a step containg just this and your intput dataset. Specify an output dataset in the JCL. This will list all records with invalid numeric data in that field. Once you understand what contains the invalid data, you can do something about it.

Re: How to convert unsigned comp-3 to numeric value

PostPosted: Tue Mar 05, 2013 11:34 pm
by skolusu
ssgan wrote:its FB file only.


Well the value you show at 47 for 4 bytes is a valid value. X'0991113F' . So there must be some other invalid record that is causing the S0C7. I suggest you run ICETOOL's VERIFY operator against the Data and you will know exactly which records are having the invalid data. I am only listing the first 100 . However you can change the limit(n) value. n can be 1 to 15 decimal digits, but must be greater than 0.

//STEP0100 EXEC PGM=ICETOOL               
//TOOLMSG  DD SYSOUT=*                     
//DFSMSG   DD SYSOUT=*                     
//IN       DD DISP=SHR,DSN=YOUR Input File
//OUT      DD SYSOUT=*                     
//TOOLIN   DD *                           
  VERIFY FROM(IN) ON(47,4,PD) LIMIT(100)   
//*

Re: How to convert unsigned comp-3 to numeric value

PostPosted: Wed Mar 06, 2013 12:05 am
by BillyBoyo
ssgan, I've just realised you are showing one record, which is line 15 of your file. Are the previous 14 records not of the same type?