REXX - UPDATE db2 load card using load file



IBM's flagship relational database management system

REXX - UPDATE db2 load card using load file

Postby malikns » Mon Jan 16, 2012 4:27 pm

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
malikns
 
Posts: 3
Joined: Fri Dec 16, 2011 2:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX - UPDATE db2 load card using load file

Postby NicC » Mon Jan 16, 2012 4:52 pm

Jolly good. Go ahead. But you should investigate as to why the original card is being created incorrectly.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: REXX - UPDATE db2 load card using load file

Postby malikns » Tue Jan 17, 2012 10:45 am

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
malikns
 
Posts: 3
Joined: Fri Dec 16, 2011 2:26 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX - UPDATE db2 load card using load file

Postby NicC » Wed Jan 18, 2012 1:18 pm

Yes I can - how much do you want to pay?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: REXX - UPDATE db2 load card using load file

Postby malikns » Mon Jan 23, 2012 2:11 pm

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
malikns
 
Posts: 3
Joined: Fri Dec 16, 2011 2:26 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DB2

 


  • Related topics
    Replies
    Views
    Last post