Page 1 of 1

convert Value to S9(9) COMP-3

PostPosted: Thu Mar 10, 2011 2:49 am
by rjambu
I need to convert the 3rd column of the file to S9(9) COMP-3

Input file that comes from diff source is like :
--------------------------
000056-2¦111¦2.000 ¦PA¦
000012-2¦222¦0.000 ¦OH¦
001293-1¦333¦10.000 ¦CT¦
001393-1¦444¦1224.000 ¦AZ¦



The issue is when i view the output file (Hex mode) it is having 000 to its value
this is same when i use the file to load a table

Eg.
2.000 is converted to 2000
10.000 is converted to 10000
1224.000 is converted to 1224000

is there a way to eliminate the 3 zeros

Below is the JCL, i use to conver the packed decimal

//STEP010 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD  DSN=A.B.SRC1
//SORTOUT  DD DSN=A.B.TGT1,
// UNIT=DISK,SPACE=(TRK,(1,2),RLSE),
// DCB=(LRECL=16,BLKSIZE=0,RECFM=FB),
// DISP=(NEW,CATLG,DELETE)
//SYSSORT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//*
//SYSIN DD *
SORT FIELDS=COPY
INREC PARSE=(%00=(ENDBEFR=X'6A',FIXLEN=06),
             %01=(ENDBEFR=X'6A',FIXLEN=03),
             %02=(ENDBEFR=X'6A',FIXLEN=10),
             %03=(ENDBEFR=X'6A',FIXLEN=02)),
BUILD=(%00,%01,%02,UFF,PD,LENGTH=5,%02)
/*
//


Thanks
JRS

Re: convert Value to S9(9) COMP-3

PostPosted: Thu Mar 10, 2011 4:27 am
by Frank Yaeger
PD format does NOT store the decimal point internally. A PD value of 2000 is stored internally as X'02000C'. A PD value of 2.000 is also stored internally as X'02000C'. The PD value itself has NO INDICATION of a decimal point. You figure that out when you represent the value externally.
Given that, your question about eliminating the 3 zeros makes no sense so you need to clarify exactly what you're trying to do.