Page 1 of 1

query on using FIXLEN in INREC parse

PostPosted: Tue Oct 16, 2012 9:57 pm
by karthiksiva
Hi, I have an input record with '|' as a field separator. The fields are of varaible length and I want to format them into a fixed length field.

859|5579|US|7041534|2012-10-03 02:11:54||2221|1|1|40007041534|2012-10-03 02:11:54||Shelf|1|
292|5579|US|674328|2012-10-04 01:18:17||JEM1|12|3|978158182276|2012-10-04 01:18:17||Shelf|1|
371|5579|US|900017|2012-10-03 04:25:56||IMS1|4|1|73481517381|2012-10-03 04:25:56||Shelf|1|
371|5579|US|900018|2012-10-03 04:27:41||IMS1|4|1|73133448368|2012-10-03 04:27:41||Shelf|1|

The fields highlighted in red, however are of twenty characters size in the input file, out of which I need only the first ten characters (date required out of a date&time field). The field can alos contain null values as shown here.

Am i right in giving ENDBEFR=X'4F' and FIXLEN=10? would the first 10 characters be taken?

SORT FIELDS=COPY
INREC PARSE=(%01=(ENDBEFR=X'4F',FIXLEN=11),
%02=(ENDBEFR=X'4F',FIXLEN=11),
%03=(ENDBEFR=X'4F',FIXLEN=02),
%04=(ENDBEFR=X'4F',FIXLEN=11),
%05=(ENDBEFR=X'4F',FIXLEN=10),
%06=(ENDBEFR=X'4F',FIXLEN=10),

%07=(ENDBEFR=X'4F',FIXLEN=40),
%08=(ENDBEFR=X'4F',FIXLEN=40),
%09=(ENDBEFR=X'4F',FIXLEN=40),
%10=(ENDBEFR=X'4F',FIXLEN=16),
%11=(ENDBEFR=X'4F',FIXLEN=11),
%12=(ENDBEFR=X'4F',FIXLEN=10),
%13=(ENDBEFR=X'4F',FIXLEN=16),
%14=(ENDBEFR=X'4F',FIXLEN=20),
%15=(ENDBEFR=X'4F',FIXLEN=06)),
BUILD=(%01,12:X'4F',12:%02,21:X'4F',22:%03,24:X'4F',25:%04,35:X'4F',
36:%05,46:X'4F',47:%06,57:X'4F',58:%07,78:X'4F',79:%08,99:X'4F',
100:%09,120:X'4F',121:%10,131:X'4F',132:%11,137:X'4F',138:%12,
148:X'4F',149:%13,159:X'4F',160:%14,161:X'4F',162:%15,167:X'4F')

please do help.

Re: query on using FIXLEN in INREC parse

PostPosted: Tue Oct 16, 2012 10:21 pm
by skolusu
A Quick test of the control cards would have answered your question. And yes with FIXLEN=10 , you are only going to get the first 10 characters.