Hi Experts,
I have the below proble,
I have a fixed lenght file with different record type.
the first two characers would determine the record type
01 header
02 data
03 different data
09 trailer
now some of the records for eg 02 04 06 may have one decimal fields(15,2)
but in different locations eg 10,20 30.
now based on this first two charecters i need to change the decimal to packed decimal. based on this record type
for ex rec type 01 09 08 needs nothign to be done.
if record type is 02 then decial field starting from position 10 needs to be converted to packed decimal,
if record type is 04 then starting from 20 needs to be converted
now some of the records for eg 02 04 06 may have one decimal fields(15,2)
What are all the record types and their respective decimal field position mapping? What about record type 03,05,07?
Quote:
now based on this first two charecters i need to change the decimal to packed decimal.
Do you want to overlay decimal with PD? I ask this because your PD Fields will be less in length than your decimal field? Do you want conversion with the same field length?
If possible, show your input with all the conditions covered and expected output.
below is my input data
016UKBADITM003 20100809
02008540003786200808180101ABCDEFGHIKJLMNON
03008540003786201004300000000000645.00
0401096001049920071031000000000100000008001
0500854000378620090305000000000102.000
0601095039440820090221035030000000000000.0000000000000000
070109605376162001020200000000070000000001000.00
99000000813782735000000064120100809
In the output every thing should be as it is except the red coloured ones.
the red coloured ones should be converted to
S9(13)v99 COMP-3 (packed decimal)
just one more question just out of curiosity,
if the above file was VB LRECL 80, would this still be possible.
if yes wat chnages would be needed in the above code.
one thing i'm getting is that the packed fields record packed field is 15 bytes so S9(27)v99 comp-3 for record type 03,06 and 07 are
ut what is required is s9(15)v99 comp-3
it should be s9(13)v99 comp-3, i think i have got it
OVERLAY=(23:23,16,SFF,TO=PD,LENGTH=08,X8)),
is working but for record type 6
0601095039440820090221035030000000000000.0000000000000000
as it is in the middle i get 8 spaces , how can this be avoided
pema_yozer,
It will be really helpful to understand if you could you please ask all your question in single post.
Quote:
one thing i'm getting is that the packed fields record packed field is 15 bytes so S9(27)v99 comp-3 for record type 03,06 and 07 are
ut what is required is s9(15)v99 comp-3
I could hardly understand anything from above.
Quote:
it should be s9(13)v99 comp-3, i think i have got it
OVERLAY=(23:23,16,SFF,TO=PD,LENGTH=08,X8)),
is working but for record type 6
0601095039440820090221035030000000000000.0000000000000000
What is X8, did you mean to add 8 space char. following packed decimal field? Why couldn't you just use LENGTH=16?
smijoss,
Quote:
since your length will change dont use overlay use build
I don't think his length is changing or he ever requested change in the length.
hi sqlcode,
wanted a 8 byte code but your code gave me a 16 byte,so i made it 8 byte and gave 8 blanks in the end.
This was fine for all other record type as the decimal was the last field followed by blank spaces.
How ever for record type 06 this didnt work as it gave blanks in between the records as the decimal was in b/w the recrd so was looking for a build code for it.
got one but it is giving a syntax error.
new to df sort and sorry for the confusion
Need to run the below code on the input record.
the red part must be converted to PD 8 byte and should be followed by remaining data immediately
the spaces are getting filled when i submit the post
060109600104992010010703505packeddecimalspaces0000000000000
060109600104992010010703505packeddecimal0000000000000
packed decimal = 8 byte packed decimal and the
spaces = 8 spaces
but i would require it as the second one
I hate to keep this post going but are you still using FB? You had mentioned your question relating to VB was out of curiosity.
Please tell us if you are using VB or FB file. Reason I am asking is you are overlaying some of the fields (following your conversion) for record type 06 or may be I am missing some basic information.
i'm using FB.
and want the PD to be 8 bytes
i had used over lay to get the format
060109600104992010010703505packeddecimalspaces0000000000000
but this is incorrect due to the space and would require
060109600104992010010703505packeddecimal0000000000000