October 31, 2007, 05:53 AM
robymodify include
Hy!! I must add the instances in DB2 table.
Format field table DB2 (name table is OPMOV)
name field DB2 format master Focus Movim integer I9L
Dt_trade date yymd
Acqvend char(1) A1
I use this instruction:
Define file AAAAA
SN_MOVIMEN /i9l = 7022;
dt_trade /yymd = 20071031:
acqvend /a1 = ‘’;
end
-*
Table file AAAAA
Print SN_MOVIMEN
Dt_trade
acqvend
On table hold as ‘OPINSER’
End
-*
MODIFY FILE OPMOV
FIXFORM SN_MOVIMEN
FIXFORM SD_TRADE
MATCH SN_MOVIMEN
ON NOMATCH INCLUDE
ON MATCH REJECT
DATA ON OPINSER
END
The program adds instances but the output is incorrect :
MOVIMEN TRADE ACQVEND
7022 1901-02-02 2
Thanks for any help!!!
October 31, 2007, 06:00 AM
FrankDutchRoby
change this line
dt_trade /yymd = 20071031:
to
dt_trade /yymd = '20071031':
Per favore update your Signature in your users profile so we do not have to ask you what system you are using.
Grazie!
October 31, 2007, 07:38 AM
robythe output is always
MOVIMEN TRADE ACQVEND
7022 1901-02-02 2
I try also:
dt_trade /A8 = '2007-10-31'
October 31, 2007, 09:04 AM
FrankDutchRoby
try this
DEFINE FILE CAR
SN_MOVIMEN/I9L = 7022;
DT_TRADE/YYMD = '20071031';
ACQVEND/A1 = '';
END
-*
TABLE FILE CAR
PRINT SN_MOVIMEN
DT_TRADE
ACQVEND
BY COUNTRY
-*ON TABLE HOLD AS ‘OPINSER’
END
And tell me if this works.....
Compare my code to yours and see all the differences, like ":" instead of ";" etc
November 01, 2007, 04:55 AM
GamPRoby,
First: Please update your signature, so we can help yoou better.
Next: you have not included your master file OPMOV, so I can't really be sure of the data formats in that database.
The code below should work.
A few things to note:
- you should really do a HOLD FORMAT ALPHA. If you do a MODIFY with a FIXFORM like you do, the data should be normally readable. Otherwise you could use FOXFORM FROM HOLD, but then all the fields in the HOLD file MUST be present in the MODIFY.
- I had to specify the WITH clauses to be able to print anything. This is because it needs a reference point in the dtaa. If your database AAAA contains the defined fields, you don't need that. Same is valid for the RECORDLIMIT.
- In the MODIFY you should specify how many characters the modify must read for each field in the fixform. This ensures that you always read the correct number of bytes and is just good practice.
- You should especially take care of reading the entire record from your hold file. There are cases where the records will be wrapped around, and that is not desirable.
SET HOLDLIST=PRINTONLY
DEFINE FILE CAR
SN_MOVIMEN /I9L WITH COUNTRY = 7022;
DT_TRADE /YYMD WITH COUNTRY = '20071031';
ACQVEND /A1 WITH COUNTRY = ' ';
END
-*
TABLE FILE CAR
PRINT SN_MOVIMEN
DT_TRADE
ACQVEND
IF RECORDLIMIT EQ 1
ON TABLE HOLD AS 'OPINSER' FORMAT ALPHA
END
-*
MODIFY FILE OPMOV
FIXFORM SN_MOVIMEN/9 SD_TRADE/8 ACQVEND/1
MATCH SN_MOVIMEN
ON NOMATCH INCLUDE
ON MATCH REJECT
DATA ON OPINSER
END
Let me know if this helped in getting the right results.
November 05, 2007, 05:05 AM
robythe output is correct!!
thank you very much!