Page 1 of 1

REXX - UPDATE db2 load card using load file

PostPosted: Mon Jan 16, 2012 4:27 pm
by malikns
Hi,

I am generating a loadcard using db2 option but it is generating incorreclty. I want to update a db2 loadcard using 1st record of the load file to put the correct length and position USING REXX.

Input:
ex: CUSTOMER_KEY POSITION (81) CHAR (8) ,
CCY POSITION (89) CHAR (3) ,
SFX POSITION (92) CHAR (3) ,

Output should generate:
CUSTOMER_KEY POSITION (1) CHAR (8) ,
CCY POSITION (9) CHAR (3) ,
SFX POSITION (13) CHAR (3) , .

Thanks

Re: REXX - UPDATE db2 load card using load file

PostPosted: Mon Jan 16, 2012 4:52 pm
by NicC
Jolly good. Go ahead. But you should investigate as to why the original card is being created incorrectly.

Re: REXX - UPDATE db2 load card using load file

PostPosted: Tue Jan 17, 2012 10:45 am
by malikns
Hi,

Can you write a REXX program that will accept input in below format(incorrect) and generate output shown below:

Input:
ex: CUSTOMER_KEY POSITION (81) CHAR (8) ,
CCY POSITION (89) CHAR (3) ,
SFX POSITION (92) CHAR (3) ,

Output should generate: It should start from POSITON 1 and upadate according to the length and so on as shown below.
CUSTOMER_KEY POSITION (1) CHAR (8) ,
CCY POSITION (9) CHAR (3) ,
SFX POSITION (13) CHAR (3) , .....

Thanks

Re: REXX - UPDATE db2 load card using load file

PostPosted: Wed Jan 18, 2012 1:18 pm
by NicC
Yes I can - how much do you want to pay?

Re: REXX - UPDATE db2 load card using load file

PostPosted: Mon Jan 23, 2012 2:11 pm
by malikns
Hi All,

Finally ,I have created the tool in REX and it works fine. Please see the logic below for your refrence.

j = 1
n = 1
begin = 80
SAY 'Processing ...........'
SAY 'Please wait ..........'
CALL READ_INPUT_FILE
outdata.n = indata.1
call WRITE_OUTPUT_FILE
n = n + 1
do a = 2 to indata.0
now_ist = word(indata.a,1)
now = words(indata.a)
if now_ist = 'NULLIF' then
do
call process_nullif
else do
if index(indata.a,',') /= 0 then
do
if index(indata.a,':') = 0 then
do
x = 0
k = 0
now = words(indata.a)
if now = 6 then
do
now = now - 1
now2 = now - 2
W = word(indata.a,now)
y = word(indata.a,now2)
x = pos(')',w)
.
.
.

Thanks,
malikns